2011-08-22 34 views
1

給定VS2010的C#解決方案,如何導出當前的構建/編譯設置,以便可以使用命令行構建/編譯它。如何導出VS2010命令行構建/編譯參數

+0

問題是你將如何使用命令行構建。據此,我認爲答案可以不同。 –

+0

如果你的意思是通過「csc」;注意,雖然你可以讓IDE發出這個(我仍然試圖挖掘出如何),但它是一個白色的謊言:http://blogs.msdn.com/b/ed_maurer/archive/2008/06/11 /a-tale-of-two-compilers.aspx –

+0

複製它從輸出窗口:) –

回答

4

您是否定製了任何構建選項?您可以從Visual Studio 2010命令提示符使用msbuild。

msbuild YourSolution.sln 

您還可以指定各種解決方案屬性,例如配置。

msbuild YourSolution.sln /p:Configuration=Release 
2

如果您的意思是通過「csc」;調出Output窗口;構建並將其更改爲Build;現在在該窗口中查找csc。例如:

Task "Csc" (TaskId:21) 
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\x86\Debug\ConsoleApplication26.exe /target:exe Program.cs Properties\AssemblyInfo.cs "C:\Users\mgravell\AppData\Local\Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs" (TaskId:21) 

或(在不同的輸出電平):

CoreCompile: 
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\x86\Debug\ConsoleApplication26.exe /target:exe Program.cs Properties\AssemblyInfo.cs "C:\Users\mgravell\AppData\Local\Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs" 

enter image description here

但請注意,the command it displays is a white lie

+0

我沒有看到有一個生成窗口 – q0987

+0

@ q0987的**輸出**窗口,然後選擇「構建」選項*在*窗口中 –