I just emailed Jamie Cansdale at TestDriven.NET but in the meantime, this might come in useful to someone out there using TestDriven.NET...
As discussed in the FAQ you can use access appSettings values from a .config file.
I discovered a way of making this just a little bit easier to manage:
- Add an
App.Config file to your Class Library root folder along with all your tests, and rename it to match the name of the .dll of the unit test class library (e.g. MyProject.Tests.dll.config)
- Add your config settings (i.e. appSettings and so on) in the normal way
It this point, when
trying to run a test, TestDriven (or possibly NUnit itself?) will not be able to find
your config settings because the config file should really have been
placed in the bin folder but we'd then need to manage 2 copies (one for
each of the Release and Debug folders), and anyway, it's easier for you to see
and manage the config file if it's in the project root folder along with all your other classes rather
than having to move it to the bin folder (because we'd then have to
mess about doing 'show all files' and 'include in project')
To get round this problem without having to move the config file:
- Add a pre-build command to the unit test project:
(i.e. under the Project Properties dialog (Build Events | Pre-Build Command Line)) - enter the following command:
xcopy $(ProjectDir)$(TargetFileName).config /YR
this will copy the [tests.dll].config file to the (Release or Debug) bin folder
Assumptions:
-
This advice applies to VS2003, it is probably very similar for VS2005
but I've not tried it (in fact, if I remember correctly, VS2005 has a
much more intuitive method for copying files into the bin directory at
build time which won't need an xcopy command...)
-
Your unit tests reside in their own Class Library project
UPDATE: Jamie Cansdale has also now
posted on this topic
The other day I was looking again at where the excellent FlexWiki project has been progressing and I decided I'd like to download the sourcecode, only to realise I'd need a CVS client to access the source-control database. I promptly downloaded TortoiseCVS and was stunned to discover how easy it was to use. It got me thinking that I might as well start running a CVS locally on my machine for source-control.
I then naturally revisited the idea of using Subversion instead as I had read many times how it was "a compelling replacement for CVS" . It so happens that I decided to just start off with TortoiseSVN (a client app for Subversion) with the aim of seeing how that works and it turns out that it has an amazingly handy feature whereby you can use TortoiseSVN to setup and run a source-control repository locally. TortoiseSVN then treats that location on your hard drive exactly as if it were a Subversion server proper.
With this proliferation of Tortoises in my life I decided to hark back to my days as a Zoology student and have a look at what other Chelonia I might expect to find here in Europe. I like the Golden Greek Tortoise the best...

see http://www.chelonia.org/European_Gallery.htm for more!
I passed my first MCP exam today with a satisfyingly high score (hint: > 900)!
I'm delighted to be able to say with confidence that I am now a certified expert in Developing and Implementing Web Applications with Visual C#.Net and Visual Studio.NET (070-315)
[UPDATE] after kind congrats from Thomas Williams I thought I'd say something about how I managed this feat ;-)
For anyone else wanting to do the same, be aware that the MS Press books DON'T cover everything you need to know in the exams. While they're a good foundation they miss out material or don't go into enough detail. I have read very good reviews of the MCSD/MCAD Training Guide by Amit Kalani if you want to be sure of not missing anything.
Of course, there's no substitute for experience of actually using the technology (which is a good thing of course - dump the braindumps).

This is just to test that
my new dasBlog blog is cross-posting OK to
my SharePoint blog and to
my dotnetjunkies blog
I think it's fair to say that I'm one of the unwashed masses that Steve Maine refers to in his article on contract-first is not the same as WSDL-first (no offence taken) so I don't have anything technical to add but I am currently reading this and related info with great interest. I've been feeling really misled by the original hype about how ASMX was supposed to enable the building of solutions in a distributed architecture, without having to leave the comfortable surroundings of coding .Net classes and methods.
I'm currently developing just in an intranet environment so having tried to 'do the right thing' and make use of Web Services for anything I might want to re-use in a number of client applications I've met with alot of grief. I quickly realised that starting from my object model in .Net code and then trying to squeeze that structure and logic through the WSDL pipeline to a client at the other end, lots of 'stuff' gets lost, and as Will Provost makes clear, this is also a problem in other environments such as Java.
I was thinking I might have to resort to .Net Remoting instead which didnt look like it was going to be any easier at first glance, but then I started reading Christian Weyer's posts on how he has crafted a Visual Studio .Net Add-In to make the WSDL/XSD-first approach much easier.
Thanks Christian, I'll give it a try!
[UPDATE]
March 8 2005
The debate is growing:
Should Developers Be Forced To Learn WSDL?
I'm still trying to come to terms with what all the great new developments for Office Programability will mean (i.e. what should I use now, what should I keep an eye on for next year, what is just not relevant?) and I'll try and post some findings here.
In the meantime I'm going to compile a list of useful URL's here once I get a minute (useful for me that is, it you find it useful too then that's even better).
But the first one I have to mention is Smart Documents Made Easier for .NET Developers on MSDN courtesy of Vertigo Software
Woohoo!, I love using
Onfolio but I'm also starting to love using OneNote too (only wish I had a tablet PC) but the forthcoming
managed API for OneNote really opens up some exciting possibilities for managing 'nebulous' research information in one place, now I can code it myself. I think I'll also suggest 'export to OneNote' as a feature request for Onfolio.
Mmmm! I like
this. The boss will like it too. I remember how much of a nightmare it was to think how to try and do something like this in Crystal (although maybe that was just me not being able to find it in the oh-so-easy-to-search documentation from Seagate ;-)
I love NotePad2, you can do RegEx search/replace and loads more, but I have one suggestion. I can use the following Registry Key to add NotePad2 to my 'View Source' in Internet Explorer:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name]
@="c:\Program Files\NotePad2\Notepad2.exe"
BUT, I cannot find a way to make notepad2 open another instance of the progam. If I already have notepad2 running, a dialog asks me if I want to save the currently open file, which is not what I want, I want to have multiple notepad2 windows open.
the -n switch usually works, so I tried:
"c:\Program Files\NotePad2\Notepad2.exe" -n
and
"c:\Program Files\NotePad2\Notepad2.exe -n"
But no luck, so I emailed the author. I'll post here if I find a solution.
[Update: thanks everyone for the useful comments, in fact I emailed Flo about this issue and in fact he/she has decided to release version 1.0.10 with ReuseWindow off by default. Fast work! maybe it had already been on the TODO list?... some other interesting features now too - it just gets better!
Thanks especially to Wes for the Registry hack, useful for distributing to others in my team who might not think of this issue until they get to it, and might assume it's a bug:
Under [HKEY_CURRENT_USER\Software\Notepad2\Settings] you can add a new DWORD value with the name "ReuseWindow" and give it a value of 0. This will have it open a new window by default.]
I have been getting very excited about VSTO. As soon as I started playing I realised that I'd be able to create a template project and have code that could fill in some of the fields such as names and addresses based on the XML nodes it finds in the template.
I decided that I could have one, very generic .Net assembly that fills-in fields within the document based on their names. I could then hook-up multiple word templates to that assembly simply by making sure that the document template has the '_AssemblyLocation0' and '_AssemblyName0' custom properties mapping to the assembly in question. The beauty of this is that a non-developer could do the same as long as then followed the agreed naming convention for the XML nodes within the document.
The challenge now was to have code that ran when opening a new document based on the template, but then 'un-hooking' the code from the resulting document so that it was just an ordinary letter or fax again. The answer was to delete the custom document properties as follows (I also show how I added some new custom document properties).
ThisDocument.CustomDocumentProperties("_AssemblyLocation0").Delete()
ThisDocument.CustomDocumentProperties("_AssemblyName0").Delete()
With ThisDocument.CustomDocumentProperties
.Add("NameID", False, Office.MsoDocProperties.msoPropertyTypeNumber, 14543)
.Add("ClientCode", False, Office.MsoDocProperties.msoPropertyTypeString, "GS1564")
.Add("AutoGeneratedDate", False, Office.MsoDocProperties.msoPropertyTypeDate, Now())
End With
[UPDATE - I have since found some info on the SetAssemblyNameAndLocation method, which you can use to set assembly links from an admin script]
I came across a couple of things that had me stuck though, which I thought might be worth blogging about:
I was totally stuck wondering why code I had put into a document template project didnt run when word created a new document based on that template.
In the meantime I used Matt Reynolds' fantastic newsgroup aggregator to have a search on the VSTO newsgroup:
http://www.dotnet247.com/247reference/msgs/47/237749.aspx
And I found this:
"The reason the document does not execute the assembly is that the property _AssemblyLocation0 references a relative location. When the document or the template itself is moved to a different location, the assembly cannot be found any more.
The easy workaround is to edit this property and make it an absolute location instead. It is easy to do that by hand by going to the menu File/Properties/Custom. It can also be done at runtime. One of the VSTO Word samples does exactly that in method MakeAbsoluteAssemblyLocation."
Which I think also makes a useful point which I have made a mental note of. Eventually I realised that, in this case, I needed to put the code into the 'ThisDocument_New 'procedure, instead of 'ThisDocument_Open'.
See also the 'Assembly Cannot Be Found' section of this troubleshooting article: Troubleshooting in Office at Run Time
My challenge now is: How do I pass parameters such as a client ID so that my code knows what data to fill in?
[UPDATE:
I got some replies to this last question: http://www.dotnet247.com/247reference/msgs/50/250487.aspx
My feeling is that, since all our users will be using IE, the best way might be to go for a really simple solution and use javascript to pass some structured data (XML?) into the clipboard (using .execCommand("Copy")), as in: http://www.dynamicdrive.com/dynamicindex11/copytext.htm
Presumably VSTO can then attempt to access the clipboard data on opening...]
[UPDATE 2:
This post has been listed on MSDN!