首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我可以使用NAnt瞄准Silverlight3.0吗?

我可以使用NAnt瞄准Silverlight3.0吗?
EN

Stack Overflow用户
提问于 2009-10-02 10:49:59
回答 3查看 918关注 0票数 2

如何将Silverlight3.0目标框架添加到NAnt?我尝试修改基于Silverlight2.0profile的nant.exe.config文件,但在编译过程中失败,并显示从波兰语翻译过来的CS0518: Type "System.Object" not defined or imported错误消息。此外,silverlight-2.0目标似乎没有像Visual Studio那样设置"SILVERIGHT“条件编译定义,这使得编写多目标库变得复杂。

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

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-08-04 05:30:19

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

我有一个解决方案,其中包括一个Silverlight4应用程序和一个.NET 3.5 ASP.NET web项目,我正在使用alpha release net-4.0框架进行编译,它工作得很好。

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

票数 1
EN

Stack Overflow用户

发布于 2009-11-05 03:44:38

看起来Richard B对Nant.exe.config的修改是正确的。我将下面这段XML添加到配置文件中,并在我的主构建文件中将nant.settings.currentframework属性设置为silverlight-3.0,一切都很顺利。(注意:我将其放在配置文件中的第775行,紧跟在silverlight-2.0框架定义之后)。希望这能有所帮助

代码语言:javascript
复制
        <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
EN

Stack Overflow用户

发布于 2009-11-05 02:20:02

@skolima...这可能是因为您没有指向正确的目录吗?实际上,我自己也很想知道这一点,因为我正在使用SL3,并希望使用nAnt进行构建自动化。

我也想知道,基于这里的一些其他帖子,你可能需要编辑nant.exe.config文件来添加silverlight-3的“配置文件”。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1508856

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档