Erich,
 
I haven't yet released a nightly build containing this features, but will do
so later today.
 
If you're building from CVS then you already have access to the goodies ...
 
Was I you that I discussed this feature with once ?
 
Gert

  _____  

From: Erich Eichinger [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 16 november 2007 16:44
To: Gert Driesen; [EMAIL PROTECTED];
nant-developers@lists.sourceforge.net
Subject: RE: [NAnt-users] Strict execution of managed applications


Hi,
 
Cool! Thanks a lot - I'll give it a shot on our Spring.NET codebase asap.
 
keep up the great work!
 
cheers,
Erich


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gert Driesen
Sent: Friday, November 16, 2007 2:16 PM
To: [EMAIL PROTECTED]
Cc: nant-developers@lists.sourceforge.net
Subject: [NAnt-users] Strict execution of managed applications


Hi,
 
Today, I've finally introduced support for running a Managed application on
a specific version of a CLR.
 
We've been supporting running an application on a given CLR for quite a
while now, but we did not provide direct support for forcing an application
to run on a specific CLR version.
 
Meaning, you could not take an application compiled against .NET 1.1 and
force it to run on the .NET 2.0 CLR.
 
Well, you could do it by modifying or creating an application configuration
file for that application or by using construct specific for a given CLR
(eg. using COMPLUS_VERSION environment variable for the MS CLR), but there
was no fexible and portable mechanism to achieve this.
 
Now there is:
 
<project default="run-tests">
    <property name="supported.frameworks"
value="net-1.1,net-2.0,mono-1.1,mono-2.0" />
 
    <target name="run-tests" depends="compile">
        <foreach property="framework" item="String"
in="${supported.frameworks}" delim=",">
            <if test="${framework::exists(framework)}">
                <property name="nant.settings.currentframework"
value="${framework}" />
                <call target="test" />
            </if>
        </foreach>
    </target>
 
    <target name="test">
        <exec program="nunit-console.exe" managed="strict">
            <arg value="/noshadow" />
            <arg file="Cegeka.HealthFramework.Tests.dll" />
        </exec>
    </target>
    

    <target name="compile">
        <csc ... />
    </target>
</project>
 
This small (and incomplete) example shows how to use nunit-console to run
unit tests against a set of different CLR's.
 

The "trick" here is the value of the "managed" attribute on the <exec> task.
By setting it to "strict", you instruct the task to run the application in
Strict mode.
 
Developers extending NAnt, can achieve the same result for tasks deriving
from ExternalProgramBase.by changing the value of the Managed property.
 
What this "Strict" mode means for a given target framework is configured in
the NAnt configuration file. 
 
Let's take the framework definition for the Mono 2.0 profile as an example:
 
<framework name="mono-2.0" ...>
    <runtime>
        <probing-paths>
            <directory name="lib/mono/2.0" />
            <directory name="lib/mono/neutral" />
            <directory name="lib/common/2.0" />
            <directory name="lib/common/neutral" />
        </probing-paths>
        <modes>
            <auto>
                <engine program="${runtimeEngine}" />
                <environment>
                    <variable name="PATH"
path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" />
                    <variable name="MONO_CFG_DIR"
path="${configDir};%MONO_CFG_DIR%" />
                </environment>
            </auto>
            <strict>
                <engine program="${runtimeEngine}">
                    <arg value="--runtime=v2.0.50727" />
                </engine>
                <environment>
                    <variable name="PATH"
path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" />
                    <variable name="MONO_CFG_DIR"
path="${configDir};%MONO_CFG_DIR%" />
                </environment>
            </strict>
        </modes>

    </runtime>
    ...

</framework>
 
For Mono, the runtime can be instructed to forced to run an application
against a specific version of the runtime by using the --runtime
command-line option.
 
By looking at the runtime configuration section for the Mono 2.0 profile,
it's clear that the only difference between the "auto" and the "strict" mode
is exactly that additional command-line option.
 
As you can see there's no magic code involved: everything can be fully
configured in the NAnt configuration file.
 
If you have any questions or remarks regarding this new feature, just let me
know.
 
Gert

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to