2009-08-18 4 views
2

私のアプリを.NET 1.1から.NET 3.5に変換しました。残念ながら、NAntのタグは.NET 3.5をサポートしていません。だから、私はmsbuildを直接起動するためにこのタグを使用しようとしています。ここで<solution>から<exec program = msbuild> in NAnt

は、私は、.NET 1.1のために持っているものです。

<solution solutionfile="MyApp.sln" 
     configuration="ServerDebug" outputdir="MyApp\bin\ServerDebug"> 

      <assemblyfolders> 
        <include name="Dependencies\Libs\bin\ServerDebug"/> 
      </assemblyfolders> 
</solution> 

私がすべては私が複製する方法を見つけ出すことができないことを除いて、正常に動作している

<exec program="msbuild"> 
    <arg value="MyApp.sln /p:Configuration=ServerDebug;OutDir=bin\ServerDebug\" /> 
</exec> 

にそれを変換します本当に便利なタグで、コンパイラに依存関係を探す場所のヒントを与えます。

機能を複製するにはどうすればmsbuildに渡されますか?

答えて

5

私はそれが2つのオプションのうちの1つで実行できると思います。 AdditionalLibPathsまたはAssemblySearchPathsを使用するか、on MSDNと記載されています。次のような

何か:

<exec program="msbuild.exe"> 
    <arg line="/p:Configuration=ServerDebug"/> 
    <arg line="/p:OutDir=bin\ServerDebug\" /> 
    <arg line="/p:AssemblySearchPaths=Dependencies\Libs\bin\ServerDebug" /> 
    <arg line="MyApp.sln" /> 
</exec> 
3

何が価値があるのは、私がNAnt.exe.configに次を追加することにより、.NET 3.5での作業NAntの0.86を得ることができました。その後、私のビルドファイルのprojectタグ内のこのビットは私が必要としていたものでした。私は今、しばらくの間、ナントとCC.Netと構成管理をやっている

<framework 
    name="net-3.5" 
    family="net" 
    version="2.0" 
    description="Microsoft .NET Framework 3.5" 
    sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" 
    frameworkdirectory="${path::combine(installRoot, 'v3.5')}" 
    frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}" 
    clrversion="2.0.50727" 
    > 
    <runtime> 
     <probing-paths> 
      <directory name="lib/net/2.0" /> 
      <directory name="lib/net/neutral" /> 
      <directory name="lib/common/2.0" /> 
      <directory name="lib/common/neutral" /> 
     </probing-paths> 
     <modes> 
      <strict> 
       <environment> 
        <variable name="COMPLUS_VERSION" value="v2.0.50727" /> 
       </environment> 
      </strict> 
     </modes> 
    </runtime> 
    <reference-assemblies basedir="${path::combine(installRoot, 'v2.0.50727')}"> 
     <include name="Accessibility.dll" /> 
     <include name="mscorlib.dll" /> 
     <include name="Microsoft.Build.Utilities.dll" /> 
     <include name="Microsoft.Vsa.dll" /> 
     <include name="Microsoft.VisualBasic.dll" /> 
     <include name="Microsoft.VisualBasic.Compatibility.dll" /> 
     <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> 
     <include name="System.Configuration.dll" /> 
     <include name="System.Configuration.Install.dll" /> 
     <include name="System.Data.dll" /> 
     <include name="System.Data.OracleClient.dll" /> 
     <include name="System.Data.SqlXml.dll" /> 
     <include name="System.Deployment.dll" /> 
     <include name="System.Design.dll" /> 
     <include name="System.DirectoryServices.dll" /> 
     <include name="System.dll" /> 
     <include name="System.Drawing.Design.dll" /> 
     <include name="System.Drawing.dll" /> 
     <include name="System.EnterpriseServices.dll" /> 
     <include name="System.Management.dll" /> 
     <include name="System.Messaging.dll" /> 
     <include name="System.Runtime.Remoting.dll" /> 
     <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> 
     <include name="System.Security.dll" /> 
     <include name="System.ServiceProcess.dll" /> 
     <include name="System.Transactions.dll" /> 
     <include name="System.Web.dll" /> 
     <include name="System.Web.Mobile.dll" /> 
     <include name="System.Web.RegularExpressions.dll" /> 
     <include name="System.Web.Services.dll" /> 
     <include name="System.Windows.Forms.dll" /> 
     <include name="System.Xml.dll" /> 
    </reference-assemblies> 
    <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/v3.5"> 
     <include name="Microsoft.Build.Engine.dll" /> 
     <include name="Microsoft.Build.Framework.dll" /> 
     <include name="System.AddIn.Contract.dll" /> 
     <include name="System.AddIn.dll" /> 
     <include name="System.Core.dll" /> 
     <include name="System.Data.DataSetExtensions.dll" /> 
     <include name="System.Data.Linq.dll" /> 
     <include name="System.DirectoryServices.AccountManagement.dll" /> 
     <include name="System.Management.Instrumentation.dll" /> 
     <include name="System.Net.dll" /> 
     <include name="System.ServiceModel.Web.dll" /> 
     <include name="System.Web.Extensions.Design.dll" /> 
     <include name="System.Web.Extensions.dll" /> 
     <include name="System.Windows.Presentation.dll" /> 
     <include name="System.WorkflowServices.dll" /> 
     <include name="System.Xml.Linq.dll" /> 
    </reference-assemblies> 
    <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/v3.0"> 
     <include name="System.IdentityModel.dll" /> 
     <include name="System.IdentityModel.Selectors.dll" /> 
     <include name="System.IO.Log.dll" /> 
     <include name="System.Printing.dll" /> 
     <include name="System.Runtime.Serialization.dll" /> 
     <include name="System.ServiceModel.dll" /> 
     <include name="System.Speech.dll" /> 
     <include name="System.Workflow.Activities.dll" /> 
     <include name="System.Workflow.ComponentModel.dll" /> 
     <include name="System.Workflow.Runtime.dll" /> 
     <include name="WindowsBase.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')}" /> 
     <directory name="${path::combine(installRoot, 'v3.5')}" /> 
     <directory name="${path::combine(installRoot, 'v2.0.50727')}" /> 
    </tool-paths> 
    <project> 
     <readregistry 
      property="installRoot" 
      key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" 
      hive="LocalMachine" /> 
     <readregistry 
      property="sdkInstallRoot" 
      key="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder" 
      hive="LocalMachine" 
      failonerror="false" /> 
     <property name="frameworkDirectoryV35" value="${path::combine(installRoot, 'v3.5')}" /> 
     <fail if="${not(directory::exists(frameworkDirectoryV35))}">The Framework directory for .NET 3.5 does not exist.</fail> 
     <property name="referenceV35" value="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/v3.5" /> 
     <fail if="${not(directory::exists(referenceV35))}">The Reference Assemblies directory for .NET 3.5 does not exist.</fail> 
    </project> 
    <tasks> 
     <task name="csc"> 
      <attribute name="exename">${path::combine(frameworkDirectoryV35,'csc.exe')}</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="exename">${path::combine(frameworkDirectoryV35,'vbc.exe')}</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="al"> 
      <attribute name="exename">${path::combine(sdkInstallRoot, 'bin/al.exe')}</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

を:NAnt.exe.configに追加

<property name="nant.settings.currentframework" value="net-3.5" /> 

。私の経験では、Nant MSBuildタスクを使用することをおすすめしませんでした。最も簡単な方法は、タスクを作成してタスクを実行する.batファイルを作成することです。 Visual Studioのコマンドラインを使用することをお勧めするいくつかの理由があります。これは、contribを使用していてもMSIパッケージがNantで簡単に構築できないためです。その方法は簡単で簡単です。

--------- 2.0 ------------- "C:\ Program Files \ Microsoft Visual Studio 8 \ Common7 \ IDE \ devenv" C:\ YourProject \ YourSoultion.sln/Rebuildリリース

---------- 3.5 -------------- "Visual Studio 9.0 \ Common7 \ Program Files \ Microsoft \ IDE \ devenv "C:\ YourProject \ YourSoultion.sln /リビルドリリース

+0

バッチファイルでMSBuildを呼び出す方が良いのではないでしょうか? – AngryHacker

+0

Devenvは、slnファイルを作成するためにMSBuildを参照しています。 Devenvと一緒に行くMSbuild Vを呼び出すだけでは微妙な違いがあります。私たちの開発チームはVS 2008にあり、Devenvコマンドラインを呼び出すと、基本的に私たちの開発チームが生成するものと全く同じ出力が生成されます。それがMSbuildを呼び出すだけでそれを選択した私の理由です。もし何かが壊れてしまったら、リンゴとリンゴを比較していて、少なくともビルド環境を取り除くことができます。 DevenvはMsbuildを呼び出すのに比べて少し遅くなりますが、通常はそれほど多くはありません。 –

+2

DevenvはビルドサーバーにVisual Studioをインストールする必要があります。ライセンス理由(単純さ)のために、多くのビルドサーバはフレームワークをインストールしているだけで、プロジェクトをビルドするために必要なものです。とにかく避けなければならないセットアップとWeb展開プロジェクトを避け、ビルドにVisual Studioに依存しない選択肢を使用すると仮定します。 – tjmoore

関連する問題