Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build c# 6.0 on TFS 2012

Tags:

How can I build a Visual Studio 2015 solution using C# 6.0 Features at a TFS 2012 without installing Visual Studio 2015 on a build agent (using Microsoft Build Tools 2015 RC)

I Already installed MSBuild Tools but I still get exceptions. How can I Tell my build template to use MSBuild 14 (Only for one project)

And why does my TFS 2012 compile async and await (c# 5.0) without any problems while the BuildAgent only has Visual Studio 2012 installed?

I tried changing the ToolPath of my BuildProcessTemplate to MSBuild/14.0/ but I get a build error:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.targets (316): "csc2.exe" exited with code -532462766.

Installing the Microsoft.Net.Compilers 1.0.0-rc2 Compilers gives the same error.

If I compile the project using the command line I get the exact same error / although there is no error on my dev machine when using the command line with the exact same arguments.

This is the Exception I get in the command line:

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) 
like image 585
quadroid Avatar asked May 04 '15 11:05

quadroid


People also ask

What is build in C?

C Build Process is the process of converting the high level source code representation of your embedded software into an executable binary image. This Process involves many steps and tools but the main three distinct steps of this process are: Each of the source files must be compiled or assembled into an object file.

Is C++ build on C?

No, but like most myths there's a shred of truth to this. The original compiler for C with classes (which later became C++) was nicknamed CFront and did translate to C. The first cfront was compiling the language called "C with classes" but later versions compiled real early pre-std C++, not just "C with classes".

Is Linux build in C?

Linux. Linux is also written mostly in C, with some parts in assembly. About 97 percent of the world's 500 most powerful supercomputers run the Linux kernel.

What is a build file C++?

C++ compilation To build a C++ program means to compile source code from one or more files and then link those files into an executable file (.exe), a dynamic-load library (. dll) or a static library (. lib).


2 Answers

I used TFS2013 U5, but it will be same:

  • installed VS2015 RTM on BuildServer machine
  • put this into MSBuild arguments in Process part of BuildTemplate

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

Both compiling and VS-unit tests are now running OK.

like image 168
Jiří Zídek Avatar answered Sep 29 '22 15:09

Jiří Zídek


Try using either

/p:VisualStudioVersion=14.0 

or

/tv:14  

In your build arguments

like image 36
fenix2222 Avatar answered Sep 29 '22 16:09

fenix2222