Remotec
Remotec

Reputation: 10772

MSBuild Not Restoring Packages

I have a strange problem where msbuild on my local development machine will restore packages but the version on my build server will not.

Local machine version: 17.12.12.57101 Build server version: 17.12.12.57101

My data.csproj file contains the following package reference:

  <ItemGroup>
    <PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
  </ItemGroup>

The data project is referenced by my web project.

If I run msbuild targeting the web project on my local machine, it will put a copy of System.ComponentModel.Annotations version 4.7.0 in the bin\debug folder of the project.

If I do the same on my build server, the reference will not be restored and the bin\debug folder is not created.

I have also tried running nuget restore at the root level of my project - it does not search through each project and restore the packages in the *proj files, only the packages contained in package.config files. Should it do this or have I misunderstood?

I have also tried calling msbuild with the -t:restore option but that also does not work.

My local development machine has full Visual Studio installed on it, where as my build server does not so I think something is missing from the build server to tell msbuild to restore packages but I have no idea what it could be!

Upvotes: 0

Views: 43

Answers (1)

Remotec
Remotec

Reputation: 10772

This was a problem with my build server which is a Bitbucket Runner Agent running on Windows.

The runner agent cannot run as the local system account, it must run as a full user for MSBuild to properly work.

Upvotes: 0

Related Questions