I have an application that I compile for both net-1.0 and net-1.1. For my unit tests I'm linking to binary NUnit.Framework.dll that is provided by NAnt (as in the following snippet)
 
--------------
<copy file="${nant.location}/NUnit.Framework.dll" tofile="${outdir}/NUnit.Framework.dll" />
<csc ...>
<references>                                  
    <includes name="${outdir}/NUnit.Framework.dll" />
</references>
</csc>
----------
 
One of my tests relies on ConfigurationSettings.AppSettings[] to get some configuration. When I compile it on net-1.1 and run <nunit2> on it I get this strange error when getting some setting.
 
Error loading XML file c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. (c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config)
 
When the DLL is compiled for net-1.0, the test runs just fine.
 
Digging through the internet I've found a solution: I had to swap the two <supportedRuntime> lines in nant.exe.config file, so that v1.1.4322 is before v1.0.3705:
 
------------------------------------------
    <startup>
        <supportedRuntime version="v1.1.4322" />
        <supportedRuntime version="v1.0.3705" />
    </startup>
------------------------------------------
 
Now the tests compiled with net-1.0 and net-1.1 run just fine (which is big a surprise to me as I don't understand this behaviour)
 
Is it a bug in NAnt or NUnit - or maybe a Microsoft general versioning problem? Can some MS guru explain this behaviour?
 
Maybe an option is needed that will force <nunit2> to run under specified runtime? Maybe it should make use of nant.settings.currentframework?
 
Jarek

BTW. NUnit-console.exe and nunit-gui.exe themselves have similar problems. I had to modify <startup> section to make it run under net-1.1.

Reply via email to