2009-10-02 77 views
2

如何将silverlight-3.0目标框架添加到NAnt?我尝试修改基于silverlight-2.0配置文件的nant.exe.config文件,但在编译期间失败CS0518: Type "System.Object" not defined or imported [从波兰语翻译过来的错误信息]。此外,silverlight-2.0目标似乎没有像Visual Studio那样设置“SILVERIGHT”条件编译定义,这使编写多目标库变得复杂。我可以使用NAnt来定位Silverlight 3.0吗?

有没有人在这里构建混合的目标解决方案(包括用于完整.NET框架和Silverlight的库)?

回答

1

您可以下载NAnt 0.91 Alpha 2版本,其中包括对net-4.0框架的支持。该框架适用于使用Silverlight 4应用程序编译解决方案。

我有一个解决方案,其中包括一个Silverlight 4应用程序和一个.NET 3.5 ASP.NET Web项目,我使用alpha版本net-4.0框架进行编译,它工作的很好。

或者,仍然使用Nant alpha版本,如果您只需要编译一个带Nant的SilverLight 4应用程序,并且您可以从Nant CVS here.中获取silverlight-4.0框架标记并将该标记添加到您的Nant.exe.config文件。

0

@skolima ...这可能是你没有指向正确的目录吗?我真的很想知道这个,因为我正在使用SL3,并希望使用nAnt来构建自动化。

也想知道,根据SO上的一些其他帖子,您可能需要编辑nant.exe.config文件来为silverlight-3添加“配置文件”。

3

看起来理查德B在Nant.exe.config修改的正确轨道上。我将下面的XML添加到配置文件中,并且能够将我的主构建文件中的nant.settings.currentframework属性设置为silverlight-3.0,并且事情像魅力一样工作。 (注:我把它放在silverlight-2.0框架定义之后的第775行的配置文件中)。希望这有帮助

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

Thx @ckramer ...我需要在某个时候尝试脚本...你能发布你的nAnt构建文件,以便我们可以看到你的用法(特别是用于创建xap文件吗?) – 2009-11-30 05:31:52

+0

”设置为“$ {environment :: get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/Silverlight/v3.0” v4环境并安装了Silverlight 3 SDK。在安装SL4时,ckramer示例中的SL3程序集目录不存在。 – 2010-11-01 10:38:02

相关问题