Can Silverlight 3.0 be customized with NAnt?

How can I add the target silverlight-3.0 framework to NAnt? I've tried modifying the nant.exe.config file based on the silverlight-2.0 profile, but it fails at compile time with CS0518: Type "System.Object" not defined or imported

[error message translated from Polish]. Also, the silverlight-2.0 target doesn't seem to set the conditional compilation "SILVERIGHT" like Visual Studio, making it difficult to write multipurpose libraries.

Does anyone here create mixed target solutions (with libraries for the full .NET framework and Silverlight)?

+2


source to share


3 answers


You can download NAnt 0.91 Alpha 2 Release, which includes support for the net-4.0 environment. This framework works for compiling solutions with Silverlight 4 applications.

I have a solution that includes a Silverlight 4 application and a .NET 3.5 ASP.NET web project and I am using the alpha-4.0 framework to compile and it works fine.



Alternatively, still using the Nant alpha if you just need to compile your SilverLight 4 application with Nant and you can grab the silverlight-4.0 frame tag from Nant CVS here. and add this tag to your Nant.exe.config file.

+1


source


It looks like Richard B was on the right track with modifications to Nant.exe.config. I added the following XML file to the config file and was able to set the nant.settings.currentframework property to silverlight-3.0 in my main build file and also things worked like a charm. (Note: I put this in the config file on line 775 right after the silverlight-2.0 framework definition). Hope it helps



        <framework 
                name="silverlight-3.0" 
                family="silverlight" 
                version="3.0"
                description="Microsoft Silverlight 3.0" 
                sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" 
                frameworkdirectory="${path::combine(installRoot, 'v3.5')}" 
                frameworkassemblydirectory="${environment::get-folder-path('ProgramFiles')}/Microsoft Silverlight/3.0.40818.0"
                clrversion="2.0.50727"
                >
                <runtime>
                    <modes>
                        <strict>
                            <environment>
                                <variable name="COMPLUS_VERSION" value="v2.0.50727" />
                            </environment>
                        </strict>
                    </modes>
                </runtime>
                <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Microsoft Silverlight/3.0.40818.0">
                    <include name="agclr.dll" />
                    <include name="Microsoft.VisualBasic.dll" />
                    <include name="mscorlib.dll" />
                    <include name="System.Core.dll" />
                    <include name="System.dll" />
                    <include name="System.Silverlight.dll" />
                    <include name="System.Xml.dll" />
        <include name="System.Windows.dll" />
        <include name="System.Windows.Browser.dll" />
                </reference-assemblies>
                <task-assemblies>
                    <!-- include MS.NET version-neutral assemblies -->
                    <include name="extensions/net/neutral/**/*.dll" />
                    <!-- include MS.NET 2.0 specific assemblies -->
                    <include name="extensions/net/2.0/**/*.dll" />
                    <!-- include MS.NET specific task assembly -->
                    <include name="NAnt.MSNetTasks.dll" />
                    <!-- include MS.NET specific test assembly -->
                    <include name="NAnt.MSNet.Tests.dll" />
                    <!-- include .NET 2.0 specific assemblies -->
                    <include name="extensions/common/2.0/**/*.dll" />
                </task-assemblies>
                <tool-paths>
                    <directory name="${path::combine(sdkInstallRoot, 'bin')}"
                        if="${property::exists('sdkInstallRoot')}" />
                    <directory name="${path::combine(installRoot, 'v2.0.50727')}" />
                    <directory name="${environment::get-folder-path('ProgramFiles')}/Microsoft Silverlight/3.0.40818.0" />
                </tool-paths>
                <project>
                    <readregistry
                        property="installRoot"
                        key="SOFTWARE\Microsoft\.NETFramework\InstallRoot"
                        hive="LocalMachine" />
                    <readregistry
                        property="sdkInstallRoot"
                        key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0"
                        hive="LocalMachine"
                        failonerror="false" />
                </project>
                <tasks>
                    <task name="csc">
                        <attribute name="noconfig">true</attribute>
                        <attribute name="nostdlib">true</attribute>
                        <attribute name="supportsnowarnlist">true</attribute>
                        <attribute name="supportswarnaserrorlist">true</attribute>
                        <attribute name="supportskeycontainer">true</attribute>
                        <attribute name="supportskeyfile">true</attribute>
                        <attribute name="supportsdelaysign">true</attribute>
                        <attribute name="supportsplatform">true</attribute>
                        <attribute name="supportslangversion">true</attribute>
                    </task>
                    <task name="vbc">
                        <attribute name="nostdlib">true</attribute>
                        <attribute name="supportsdocgeneration">true</attribute>
                        <attribute name="supportsnostdlib">true</attribute>
                        <attribute name="supportsnowarnlist">true</attribute>
                        <attribute name="supportskeycontainer">true</attribute>
                        <attribute name="supportskeyfile">true</attribute>
                        <attribute name="supportsdelaysign">true</attribute>
                        <attribute name="supportsplatform">true</attribute>
                        <attribute name="supportswarnaserrorlist">true</attribute>
                    </task>
                    <task name="jsc">
                        <attribute name="supportsplatform">true</attribute>
                    </task>
                    <task name="vjc">
                        <attribute name="supportsnowarnlist">true</attribute>
                        <attribute name="supportskeycontainer">true</attribute>
                        <attribute name="supportskeyfile">true</attribute>
                        <attribute name="supportsdelaysign">true</attribute>
                    </task>
                    <task name="resgen">
                        <attribute name="supportsassemblyreferences">true</attribute>
                        <attribute name="supportsexternalfilereferences">true</attribute>
                    </task>
                    <task name="delay-sign">
                        <attribute name="exename">sn</attribute>
                    </task>
                    <task name="license">
                        <attribute name="exename">lc</attribute>
                        <attribute name="supportsassemblyreferences">true</attribute>
                    </task>
                </tasks>
            </framework>

      

+3


source


@skolima ... could it be that you are not pointing to the correct directories? I'm really curious about this myself as I'm working with SL3 and want to do build automation with nAnt.

It's also interesting, based on some other posts here on SO, that you might need to edit the nant.exe.config file to add a "profile" for silverlight-3.

0


source







All Articles