Packages are not restored when building a CI queue in TFS (VS Online VS2015)

I asked a question about build errors and continued to investigate this question further from my desperate self.

I have an assumption that the problem is with packages that are extracted but not placed correctly. Looking through painfully boring magazines, I gave it.

2016-01-15T21: 50: 40.8680146Z
The object "BeforeGenerateProjectPriFile" specified in the BeforeTargets attribute in "C: \ Program Files (x86) \ MSBuild \ Microsoft \ NuGet \ Microsoft.NuGet.targets (186.61)" does not exist in the project and will be ignored.

Soon after, I see the first sign that something is sideways.

2016-01-15T21: 50: 43.9631666Z ## [warning]
C: \ Program Files (x86) \ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets (1819.5): Warning MSB3245: Failed to resolve this link. Could not find assembly "Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35, processorArchitecture = MSIL". Make sure the assembly exists on disk. If this link is required for your code, you may get compilation errors.
2016-01-15T21: 50: 43.9631666Z 2>
C: \ Program Files (x86) \ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets (1819.5): warning MSB3245: Failed to resolve this link. Could not find assembly "Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version = 1.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35, processorArchitecture = MSIL". Make sure the assembly exists on disk. If this link is required for your code, you may get compilation errors. [C: \ a \ 1 \ s \ MyStuff \ MyStuff.csproj]

And then he goes on to discuss a lot of things that do not exist.

2016-01-15T21: 50: 43.9661661Z
It is considered ".. \ packages \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0 \ lib \ net45 \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll", but it does not exist.
2016-01-15T21: 50: 43.9671655Z
For SearchPath "{TargetFrameworkDirectory}". 2016-01-15T21: 50: 43.9681655Z
It is considered "C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5.2 \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.winmd", but it does not exist.
...

I am not familiar with CI on TFS and VS Online, so it tells very little about where to hit this issue. I got to death and experienced a gazillion different settings throughout the portal. Bad luck. I may cause other errors (when I know that I am typing the wrong things, etc.), but anyway, I turn to that.

Any clues would be appreciated.

+7
tfs continuous-integration msbuild vsts
source share
1 answer

Starting with version VS2015, there is no need for a NuGet folder, contrary to what I saw. In fact, the only file that is needed is the package configuration. There is a common, but very deceptive work for checking packages and their executable files, but which can create many problems in the future. I would not recommend this because he was hiding the problem, not solving it.

First, make sure your assembly is actually restoring packages. I noticed that in the error logs, this seems to be happening, but it's a trap. This is an attempt to restore, not actually success. If you encounter such a warning (and the same goes for nUnit, WebGrease, NewtonSoft, or any other package running NuGet):

Warning MSB3245: Failed to resolve this link. Could not find assembly "EntityFramework". Make sure the assembly exists on disk.

start by verifying that the logs contain the following passes:

PrepareForBuild:
Creating the directory "obj \ Debug".
...
RestorePackages:
"C: \ a \ src \ src.nuget \ nuget.exe" install "C: \ a \ src \ src \ xxxx.Entities \ packages.config"
-source -RequireConsent -o "C: \ a \ src \ src \ packages"
...
Successfully installed "EntityFramework 6.3.1". ResolveAssemblyReferences:
The main link is "EntityFramework".

Keep in mind that when you look at the log files, look for partial lines, since directories, versions, package names, etc. may vary slightly. If you cannot find it, there is a good chance that the packages will not be restored to the build server. Compiling locally proves that there is a difference between the environments, most likely the packages.config file is not available. This is a tricky mistake because failed logs will not tell you that it is missing. In fact, I did not mention it in magazines at all.

  • First, I created a new Auto project and tested it. The assembly was successful.
  • Then I added the Entity Framework and the build failed with the same warning as yours.
  • Finally, I checked the package.config file. The assembly was successful.

enter image description here

The problem arises because the initial registration chooses the number of files to ignore. This is mainly bin, obj, etc., but also package.config. It must be specifically selected as not ignored. If someone checks in all files (not very wise, in my opinion), he also gets the file necessary, and therefore it seems that if they do it correctly. Note that you must first add the file to the version control. Thus, it is checked with every change. Otherwise, problems will reappear if you add a new package locally or upgrade an existing one.

If you get a warning, but the packages are restored (the logs have the specified lines), try updating the package locally or reinstalling it. Finally, you can update the installation from the package manager console by running Update-Package -Reinstall .

  • A similar problem with the older version of the package manager is here .
  • Wrong advice on files to check (starting with VS 2015) here .
  • An outdated file layout description (valid for VS 2013 and earlier) is here .
  • Read more about the structure of the NuGet file structure here .
  • A very good blog on this issue (strange that this is not included in Google) is here .
+6
source share

All Articles