Hi all!

I have a question regarding NAnt.exe.config. Currently it has:

    <startup>
        <supportedRuntime version="v1.0.3705" />
        <supportedRuntime version="v1.1.4322" />
    </startup>

I believe there are reasons for it to be reversed:

Imagine you have both .NET 1.0 and .NET 1.1 installed. You build your
application for .NET 1.1 using "nant -defaultframework:net-1.1". What gets
compiled into your application is the reference to .NET 1.1 "mscorlib.dll",
which is fine.

The problems start when you want to run unit tests using <nunit2> task of
NAnt on your DLL.

1. NAnt.exe starts and MSCOREE.DLL decides it should be managed by CLR
"v1.0.3705"
2. CLR loads mscorlib.dll from "v1.0.3705"
3. NAnt invokes <nunit2> task (compiled for v1.0.3705) which loads your dll
(compiled for v1.1.4322)

and now you start getting lots of strange errors in different places (mostly
security problems).
Since you're running under .NET 1.0 and trying to use assemblies (also
system dlls) from .NET 1.1 you get some errors like this:

-------------------
   [nunit2] System.Configuration.ConfigurationException: Error loading XML
file f:\windows\microsoft
.net\framework\v1.0.3705\Config\machine.config Request for the permission of
type System.Security.Pe
rmissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0,
Culture=neutral, PublicKeyToke
n=b77a5c561934e089 failed.
(f:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config)
   at System.Configuration.ConfigurationRecord.OpenXmlTextReader(String
configFileName)
   at System.Configuration.ConfigurationRecord.Load(String filename)
   at
System.Configuration.DefaultConfigurationSystem.System.Configuration.IConfig
urationSystem.Init
()
   at
System.Configuration.ConfigurationSettings.SetConfigurationSystem(IConfigura
tionSystem configS
ystem)
   at System.Configuration.ConfigurationSettings.GetConfig(String
sectionName)
   at System.Configuration.ConfigurationSettings.get_AppSettings()

-------------------

Fortunately Microsoft changed the versioning rules in .NET 1.1 and it is
able to emulate the behaviour of .NET 1.0 by transparently redirecting to
its system assemblies so you are able to have one set of config settings
that work for both 1.0 and 1.1.

If you have the following order of <supportedRuntime>'s

    <startup>
        <supportedRuntime version="v1.1.4322" />
        <supportedRuntime version="v1.0.3705" />
    </startup>

.NET 1.1 (if installed) will load instead of .NET 1.0 and take control of
your NAnt.exe process. Because of its assembly redirection capabilities both
NAnt and others appdomains (like nunit2) will run smoothly.

Can someone fix it in CVS?

Jarek



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to