Re: Setting up Nunit in external tools in VS2005

"David McMinn" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
Hi Charlie,

>> I have set Nunit (2.4.7) up in the VS2005 (pro, sp1) external tools
>> menu using the full path to nunit.exe, "$(TargetPath)"
>> and "$(TargetDir)", as described in the docs. However, when I run it
>> on my unit test project (a class library DLL) I get an "Assembly not
>> loaded" exception for "nunit.framework". If I look at the project
>> configuration in Nunit then the project path seems to have the
>> intermediate directory ("...\obj\Release\..." instead of
>> "...\bin\Release\...").
> 
> VS2005 changed the meaning of TargetPath, etc. from the bin to the
> obj directories. It's annoying. 
> 
> When you say "docs" do you mean the NUnit docs? I'd like to change
> anything that is misleading there. 

Yes, in the file "NUnit 2.4.7\doc\vsSupport.html" there is a paragraph
titled "Running From Within Visual Studio" which suggests using
$(TargetPath) and $(TargetDir).

>> 1) Has anyone else had the same experience with target path being
>> wrong?
> 
> Yup. Most everyone who switches from VS2003 to VS2005.

And so it seems anyone coming from unmanaged C++ in VS2005 where
$(TargetXXXX) means the final output rather than the intermediate
outputs (obj\whatever).

>> Is this a VS2005 bug or could I be doing something wrong to launch
>> Nunit?
> 
> The VS folks think it's a feature. :-)

Hmmmm :)

>> 2) Are there any drawbacks to using the csproj rather than the
>> compiled assembly? I assume I will need to include all my unit tests
>> in this project.
> 
> No disadavantages, but you need to change the name of any test config
> file from something.dll.config to something.config and put it in the
> same directory as the csproj file.  
> 
> You can still have multiple test assemblies if you like. Either run
> each separately or create a .nunit project file that includes all of
> them. The same config file change applies.  

OK, thanks for the tips.

Cheers.
-- 
David McMinn, Maxwell Downhole Technology Ltd.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.