I've set up a new project in Jenkins. When I try to build it I get the following error:
"E:\Jenkins\workspace\MWAPIv1\My.WebAPIv1.sln" (default target) (1) -> "E:\Jenkins\workspace\MWAPIv1\My.WebAPIv1\My.WebAPIv1.csproj" (default target) (2) -> (CoreCompile target) -> C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly E:\Jenkins\workspace\MWAPIv1\packages\Microsoft.Net.Compilers.2.2.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [E:\Jenkins\workspace\MWAPIv1\My.WebAPIv1\My.WebAPIv1.csproj]
The project uses NET 4.5.2 Framework.
Some other possibly useful information:
Since the error mentions missing dlls, I checked in all files, including the packages folder and contents to SVN, but this didn't help.
I also updated all Nuget packages from within VS2015 and checked in any updates.
The project configuration in Jenkins is:
MSBuild Version: Microsoft.NET Framework v4.0
MSBuild Build File: My.WebAPIv1.sln
Command Line Arguments: /p:VisualStudioVersion=14.0
The following folders exist in my Jenkins server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0
Any ideas how to get my project to build?
Thanks
Microsoft.Net.Compilers
andMicrosoft.CodeDom.Providers.DotNetCompilerPlatform
then check in. This then built okay in Jenkins. However I am experiencing the same issue with an MVC project and removing the above packages cause my project to deliver a 500 error page. I will try Martins solution for this. – cdsln