Re: Fwd: download latest 2.4.7 zip has problem?

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <01aa01c89c48$6a2a8910$6401a8c0@ferrari>
For the way assemblies are loaded, you can look at
http://msdn2.microsoft.com/en-us/library/yx7xezcf.aspx
and then google further on some of the terms you find.
 
The change in loading is a problem for everyone who is new to .NET.
Traditional Windows used a path
as does Java, so we're all originally in the same boat.
 
The other thing that confuses people is that the way assemblies are found at
the time of compiling
is not the same as how they are found at runtime. Compilers can - and do -
hunt anyplace they
like for a needed asembly. But at runtime, it must fit into the AppBase +
probing path model,
unless you use the GAC. There are some reasons to use the GAC, but I suggest
avoiding it
till you are more familiar with the loading model.
 
In the case of NUnit loading tests, the rules are the same as for .NET in
general /except/
that NUnit establishes a new appbase and probing path for the tests, which
it loads into
a separate AppDomain. You can think of an AppDomain as something like a
lightweight
process and something like a Java VM if you like.
 
So, if there were anything in the nunit-console.exe.config, it would apply
to how NUnit
is loaded, not to how your tests are loaded. It is possible to create a
config for your 
tests - mytests.dll.config - and NUnit will arrange to have it used - that
is a possibility
for your case, unless you copy assemblies.
 
When folks work under most IDEs - including Visual Studio - referenced
assemblies
are usually copied automatically to the output directory, which means they
are 
available to load with no problem. When you do a batch build under NAnt, you
need to arrange for that to happen yourself - or create a probing path that
finds all the assemblies you need. For example, NUnit's own NAnt build puts
the output into a common directory, from which our tests are run.
 
BTW, NUnit /will/ create a probing path automatically for multiple /test/
assemblies
in different directories, but it doesn't analyze the assemblies to locate
all the
references, so that's where either copying or manually applying a path is
needed.
 
I hope this helps.
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Dean Hiller
Sent: Friday, April 11, 2008 7:28 PM
To: Charlie Poole
Cc: [email protected]
Subject: Re: [Nunit-users] Fwd: download latest 2.4.7 zip has problem?


the netmocklib cvs module is all cs.  The mocklib module is all java.

you got the below exactly correct.  At NUnit time, I want all the *'s to
run.  At application deploy time, only dlls in outassemblies are needed.  is
there some kind of tutorial on this probing(I am a newb to this and keep
searching but don't get how it works).  Also, does this 'probing' go in the
nunit-console.exe.config file?  If so, why isn't it already there
specifiying the framework.dll that comes with nunit(I am newb and just
trying to understand more here).  

dean



2008/4/12 Charlie Poole <[email protected]>:


HI Dean,
 
Assuming you have a common root directory, your structure would look like
this...
 
root
  input
    NMockLib
      LibInclude
      LibExclude *
  output
    outAssemblies *
    testAssemblies *
 
>From your note, it appears as if you want to use assemblies from the
directories marked with
a * at runtime. To do that, your Application Base should be root, with the
private probing path
set to the relative path to the three directories in question.
 
I'm not sure I got this right, however, since you said LibExclude was not
needed at runtime.
 
A basic question, which might help us help you: what does your application
do?
 
BTW, you sent me a link to a SF project by email, but all the files listed
are Java.
 
Charlie


  _____  


From: [email protected]
[mailto:[email protected]] On Behalf Of Dean Hiller

Sent: Friday, April 11, 2008 5:56 PM 

To: [email protected]

Subject: [Nunit-users] Fwd: download latest 2.4.7 zip has problem?


continue discussion on mailing list.  Lets say I have a the following
directories at output time by nant

1. input/NMockLib (contains the cs source files)
2. input/NMockLib/LibInclude (contains libraries needed to run live dll at
deployment)
3. input/NMockLib/LibExclude (contains libraries needed to compile but not
run at deployment.  This includes NUnit and any platform libraries as
well-if a platform is used)
3. output/outassemblies (contains the product to be deployed)
4. output/testassemblies (contains the test assembly that was generated)

Nant generates 3 and 4.  This is pretty much a port to .NET from the
buildtemplate project so you can unzip and start programming immediately
without needed to set up your builds.  Naturally, I don't want to copy the
framework.dll to output/testassemblies every time I build and really just
want to put it in the path(though C# has no path).  This may be more of a C#
question now then a NUnit question, but I ran into the issue first with
NUnit.  How do I make it so when nant runs nunit, it is using the dlls from
testassemblies dir, outassemblies dir, AND input/NMockLib/LibExclude dir.
My hack solution could be to copy all outassemblies dir to the
testassemblies directory and copy all the LibExclude libraries to the
testassemblies directory though this seems like a major hack.  I am pretty
sure the GAC is NOT a solution to this because if another developer checks
out NMockLib, it won't work until he installs it in the GAC then.....the
idea is to make it so once a developer installs, .NET SDK and NOTHING more,
he can check out NMockLib and run the build....no need to install fxcop, no
need to install NUnit, etc. etc.

I guess I will go with the hack of creating the testassemblies directory but
this really just seems like a hack to me.
thanks,
dean






---------- Forwarded message ----------
From: Charlie Poole <[email protected]>
Date: 2008/4/12
Subject: RE: [Nunit-users] download latest 2.4.7 zip has problem?
To: Dean Hiller <[email protected]>



Hi Dean,


Here was my experience today......
1. download nunit(in java junit)
2. unzip the zip(ps. I love that you have zips now instead of
installers!!!!)
3. compile dll against the assemblies(or jar against the jars).
4. execute NUnit(in java JUnit)
5. load assembly(in java the jar)
6. NUnit fails....JUnit passes in same scenario with no need for anything
since framework is part of the path.
NOTE:  In both cases(java/C#), the dll/jar created naturally was not copied
to the NUnit directory.  

This seems like a pretty nasty user experience for first time users.  Can we
get this functionality changed?
 
You'll have to provide more info. With the volume of mail I get, downloading
an working with your project isn't
really practical. What I suspect here is that you are running into the
somewhat fundamental differences between
Java's path-oriented location of jar files and .NET's mechanism based on the
AppBase.
 
I'll try to answer you as best I can below, with the info you have given me,
but the best way to proceed here
is to move this discussion to the mail list where there might be some other
people with time to download
and work with your project code! 
 
Alternatively, file a bug report with the info needed to resolve this as a
bug. I can see from your description
that you aren't having a great user experience, but I don't actually know
what assemblies are in what 
directories. My suspicion is that you simply are not following the rules of
.NET assembly loading.

Also, this makes another open source project I am trying to port from Java
more difficult.....(buildtemplate.zip)...you unzip and it has nant, nunit,
fxcop, etc. etc. all ready to go...no need to do any setup at all, just run
build.bat and it runs all the tools...great for first timers.  I can't seem
to get it all working in C# though.  It's on sourceforge.

Ideally, I want all output assemblies for production in
outassemblies--though I stuck the test.dll there too to get it working :(
...now  I have to drag the NUnit framework there too it seems, ugh.  I
really want a testassemblies directory separate from outassemblies.
testassemblies would have only my test dll AND I don't want to copy the
framework.dll there...that seems pretty lame(sorry, I come from java and
just throw things in the path variables with ant).   
 
The framework assembly must be in the same location as the test assembly, or
in some other location where .NET knows
how to find it. Since there is no such thing as a .NET path, the only
alternative would be to put it in the GAC. You could
do that in your install, although NUnit no longer does it because of other
problems that arose.
 
So is there any way to get nant to throw framework into the path for the
testassembly and for that matter throw the system in the path of the test
assembly.  That would make the nant builds much cleaner. 
 
I'm not clear if you are trying to test your own application, or if your
application does something to provide testing
to users. If it's the first, the normal way to do it is to copy the
necessary assemblies to the proper location. For example,
if I want to use log4net, I must copy that assembly to my bin directory -
there is no other option. If it's the second, then
it's up to your users to do that, or you may choose to do it for them.
 
It could be that I am not fully understanding you. That's why I encourage
you to go back to the mailing list, where 
other people can also contribute ideas. I'll continue to answer you as well
- in fact, I usually answer the mailing list
questions first!
 

Charlie 
 
 


thanks,
dean


2008/4/11 Charlie Poole <[email protected]>:


Hello Dean,
 
Where is the nunit.framework.dll with reference to the Test.dll. Unless you
have set up 
a probing path, it should be in the same directory.


BTW, you should not be using core in your tests. All the types you need to
refer to
are in the framework assembly, and the presence of core could confuse
things.
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Dean Hiller
Sent: Thursday, April 10, 2008 10:21 PM
To: [email protected]
Subject: [Nunit-users] download latest 2.4.7 zip has problem?


I download the latest NUnit and copy the dll's(Core and Framework) into my
lib directory.  I then try my nant build and use nunit.exe and when I open
my Test dll, I get the following error....

system.IO.FileNotFoundException: <This is in chinese> "nunit.framework,
Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" <more
chinese>

I also use exec nant task for nunit so developers don't have to install
nunit and I can upgrade nunit seamlessly without anybody knowing or
caring(ie. nant and nunit are checked into my SCM).  But, I get the
following error.....

     [exec] Runtime Environment -
     [exec]    OS Version: Microsoft Windows NT 5.1.2600 Service Pack 2
     [exec]   CLR Version: 2.0.50727.1433 ( Net 2.0.50727.1433 )
     [exec]
     [exec] 未能加载文件或程序集"nunit.framework, Version=2.4.7.0,
Culture=neut
ral, PublicKeyToken=96d09a1eb7f44a77"或它的某一个依赖项。系统找不到指定的文
件。


BUILD FAILED

c:\AAROOT\areas\docutech\WebServicesChina\bldfiles\project.build(149,7):
External Program Failed:
c:\AAROOT\areas\docutech\WebServicesChina\tools\NUnit\n
unit-console.exe (return code was -2)

Total time: 2.9 seconds.



What's wrong with the 2.4.7 zip file?  Why doesn't it work?
thanks,
dean






-------------------------------------------------------------------------
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/javao
ne
_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users

-------------------------------------------------------------------------
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

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
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.