在TFS 2012上构建c#6.0

Con*_*ole 22 c# msbuild tfs roslyn tfs2012

如何在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)
Run Code Online (Sandbox Code Playgroud)

Jiř*_*dek 17

我使用的是TFS2013 U5,但它会是一样的:

  • 在BuildServer机器上安装VS2015 RTM
  • 将它放入BuildTemplate的Process部分中的MSBuild参数中

/tv:14.0/p:GenerateBuildInfoConfigFile = false /p:VisualStudioVersion=14.0

编译和VS单元测试现在都运行正常.


fen*_*222 5

尝试使用其中之一

/p:VisualStudioVersion=14.0
Run Code Online (Sandbox Code Playgroud)

要么

/tv:14 
Run Code Online (Sandbox Code Playgroud)

在你的构建参数中