Teamcity Crashing for Nuget Packages

I added Autoumapper and NUnit packages to my solution through Nuget and they work fine, and the project compiles on my computer.

When I announced the build server to build this solution, I received the following messages:

[MSBuild] AutoMapper\AutoMapperSpike.csproj: Build default targets (1s) [10:35:50][AutoMapper\AutoMapperSpike.csproj] ResolveAssemblyReferences [10:35:50][ResolveAssemblyReferences] ResolveAssemblyReference [10:35:50][ResolveAssemblyReference] Primary reference "AutoMapper". [10:35:50][ResolveAssemblyReference] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360, 9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "AutoMapper". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [10:35:50][ResolveAssemblyReference] For SearchPath "{HintPathFromItem}". [10:35:50][ResolveAssemblyReference] Considered "..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll", but it didn't exist. 

Does anyone know how to solve this problem?

Another thing I noticed is that it creates artificts files in the build server also with the packages folder. The only thing he cannot do is build the project on the build server.

+6
source share
3 answers

In Visual Studio, a parameter in the user interface sets a value in your user profile, so you no longer have to remember it. However, there is no such option on the build server. Instead, you need to set the environment variable "EnableNuGetPackageRestore" to "true" as part of your assembly.

I would recommend not trying to set the environment variable inside your build scripts or .csproj files. Here's a blog article about why this happened and what you need to install on your dev machine / build machine.

+6
source

Make sure TeamCity is actually downloading the package. You can see this in the build history on one page of build results, on the NuGet Packages tab. If you see your package there, then TeamCity is fine with the package.

Then make sure you can create your project from VCS, i.e. take a pure clone and try to build it as such, since this is what TC should do.

My problem in a very similar scenario was that I just copied one project to another repository and links where it wasn’t, although compilation failed locally due to cached DLLs: s. Uninstalling the package and installing it again from the Visual Studio package manager fixed the problem.

+4
source

You need to either check the packages in your VCS, or - better - enable NuGet package recovery in your solution.

0
source

Source: https://habr.com/ru/post/949192/


All Articles