简体   繁体   中英

Using VS 2015 Build with Team City 9 gives error

I am trying to create a build definition to build solution using VS 2015 build definition in Team City. However when my build configuration runs it gives me the following error

C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07\\packages\\Microsoft.Net.Compilers.1.0.0\\tools\\Microsoft.CSharp.Core.targets(67, 5): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07\\packages\\Microsoft.Net.Compilers.1.0.0\\build..\\tools\\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'file:///C:\\TeamCity\\buildAgent\\work\\e6cc09e5f0da4a07\\packages\\Microsoft.Net.Compilers.1.0.0\\tools\\Microsoft.Build.Tasks.CodeAnalysis.dll' 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.

It seems to me that I am missing some dlls but the machine on which I have setup Team City for testing is also my Dev machine so by right I have everything installed and the solution is building fine.

Can you please guide me as to what might be wrong here?

I dont know whether you have moved on from this issue or not, but if someone is still getting this issue.
As Paul Hunt mentioned, this issue is happening because of nuget packages are not able to restore.
To solve this quickly on your machine just copy everything from your solution's " packages " folder to the TeamCity's buildAgent\\work[project] folder.
This issue will disappear.

I was facing the same issue but after using NuGet Installer as a build step my all problems gets resolved.

Just you need to do one thing, before going to build your project - Just add one build step and select Runner type as NuGet Installer

You can check from this screenshots:

在此处输入图片说明

You can add this for any project. Let me know if this solution works for you or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM