Build errors of missing packages in Visual Studio Online (2015 version)

12,122

Solution 1

This issue usually occurs when the nuget packages are checked in to Version Control. Delete the packages folder in Version Control, and make sure the "packages.config" file is checked in to Version Control. Then queue a new build.

Solution 2

It turns out that NuGet packages were committed to the repository and breaking everything. Deleting the project\project\packages directory from the repo solved all build problems since NuGet fetches the packages automatically on build.

Share:
12,122
Konrad Viltersten
Author by

Konrad Viltersten

A self taught code monkey since the age of 10 when I got my first computer, the coolest Atari 65XE. Later on, a mathematics and computer science student at a university with a lot of side-studies in philosophy, history, Japanese etc. Today, a passionate developer with focus on web related technology from UX, through JS/TS to C# with a touch of SQL. Motto: A lousy programmer knows how to create problems. A good programmer knows how to solve problems. A great programmer knows how to avoid them. (Get the double meaning?) Works at: http://kentor.se Blogs at: http://konradviltersten.wordpress.com Lives at: http://viltersten.somee.com

Updated on July 02, 2022

Comments

  • Konrad Viltersten
    Konrad Viltersten almost 2 years

    I'm getting the following message when I trigger a build on check-in to Visual Studio Online. Locally it compiles and deploys just fine.

    packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.CSharp.Core.targets (67, 5)

    To be more precise, this is the problem being described.

    The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\a\1\s\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'file:///C:\a\1\s\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.

    So, evidently, I have some locally placed files making the compilation work on site (i.e. my machine) but those aren't deployed using check-in. I haven't put in any DLLs or such manually into my project. Everything that's there is either source code based or obtained with the package manager.

    That poses the following issues.

    1. I don't know which exact files those are (error message in Visual Studio Online doesn't disclose that information and I can't reproduce it locally).
    2. I'm not sure how to forcingly push all the relevant files to the repository for the building agent to fetch (according ot my experience, it's done automagically).

    The settings in the build step are as follows.

    • Solution: **\*.sln
    • MsBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
    • Platform:
    • Configuration:
    • Clean: off
    • Restore NuGet Packages: checked
    • Visual Studio Version: Visual Studio 2015
    • MsBuild Architecture: MSBuild x86
    • Record Project Details: checked
  • Konrad Viltersten
    Konrad Viltersten over 8 years
    Yupp, I solved that after countless hours of trying out from 100 different angles (and some help here). In fact, what I discovered is that if one checks in the directory packages with all its contents, it works too! Omitting it entirely and only checking in the file packages.config works as well. (Of course, the correct way's probably not checking in those at all - the first option.) What happened was that I had deposited nupkg files but not the rest and that broke it! That's why my VS suggested to include/exclude...
  • Shaswat Rungta
    Shaswat Rungta over 7 years
    You may also want to add the packages path to the gitignore file