[英]Build c# 6.0 on TFS 2012
如何在TFS 2012上使用C#6.0功能構建Visual Studio 2015解決方案,而無需在構建代理上安裝Visual Studio 2015(使用Microsoft Build Tools 2015 RC)
我已經安裝了MSBuild工具,但我仍然有例外。 如何告訴我的構建模板使用MSBuild 14(僅適用於一個項目)
為什么我的TFS 2012編譯異步並等待(c#5.0)而BuildAgent只安裝了Visual Studio 2012而沒有任何問題?
我嘗試將BuildProcessTemplate的ToolPath更改為MSBuild / 14.0 /但是我遇到了構建錯誤:
C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ Microsoft.CSharp.targets(316):“csc2.exe”已退出,代碼為-532462766。
安裝Microsoft.Net.Compilers 1.0.0-rc2編譯器會出現相同的錯誤。
如果我使用命令行編譯項目,我會得到完全相同的錯誤/盡管在使用具有完全相同參數的命令行時我的開發機器上沒有錯誤。
這是我在命令行中獲得的異常:
C:\Program Files (x86)\MSBuild\14.0\bin\csc2.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentro.....
Unhandled Exception: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Collections.Immutable.SecurePooledObject`1.Use[TCaller](TCaller& caller)
at System.Collections.Immutable.SortedInt32KeyNode`1.Enumerator.PushLeft(SortedInt32KeyNode`1 node)
at System.Collections.Immutable.SortedInt32KeyNode`1.Enumerator..ctor(SortedInt32KeyNode`1 root)
at System.Collections.Immutable.ImmutableDictionary`2.Enumerator..ctor(SortedInt32KeyNode`1 root, Builder builder)
at Microsoft.CodeAnalysis.RuleSet.GetDiagnosticOptionsFromRulesetFile(Dictionary`2 diagnosticOptions, String resolvedPath, IList`1 diagnosticsOpt, CommonMessageProvider messageProviderOpt)
at Microsoft.CodeAnalysis.CSharp.CSharpCommandLineParser.Parse(IEnumerable`1 args, String baseDirectory, String additionalReferencePaths)
at Microsoft.CodeAnalysis.CSharp.CSharpCommandLineParser.CommonParse(IEnumerable`1 args, String baseDirectory, String additionalReferencePaths)
at Microsoft.CodeAnalysis.CommonCompiler..ctor(CommandLineParser parser, String responseFile, String[] args, String baseDirectory, String additionalReferencePaths)
at Microsoft.CodeAnalysis.CSharp.CSharpCompiler..ctor(CSharpCommandLineParser parser, String responseFile, String[] args, String baseDirectory, String additionalReferencePaths)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc..ctor(String responseFile, String baseDirectory, String[] args)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args)
at Microsoft.CodeAnalysis.BuildTasks.BuildClient.RunWithConsoleOutput(String[] args, RequestLanguage language, Func`2 fallbackCompiler)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc2.Main(String[] args)
我使用的是TFS2013 U5,但它會是一樣的:
/tv:14.0 / p:GenerateBuildInfoConfigFile = false /p:VisualStudioVersion=14.0
編譯和VS單元測試現在都運行正常。
嘗試使用其中之一
/p:VisualStudioVersion=14.0
要么
/tv:14
在你的構建參數中
JiříZídek的答案是正確的,但缺少一個關鍵細節。 我必須執行以下操作才能使TFS 2012 Update 2正常運行:
MSBuild Arguments
設置為/p:VisualStudioVersion=14.0
(即Visual Studio 2015模式) install-package Microsoft.Net.Compilers
#3對我來說有所不同。
對於那些使用TFS 2012和VS 2017繞過2015年的人,您可以按照我的回答輸入鏈接描述
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.