最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nuget - MSBuild Not Restoring Packages - Stack Overflow

programmeradmin0浏览0评论

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!

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!

Share Improve this question asked Feb 2 at 14:07 RemotecRemotec 10.8k28 gold badges117 silver badges159 bronze badges 1
  • The build machine must have Visual Studio (at least the "Build Tools for Visual Studio" edition) installed if any of the projects are .NET Framework. The standalone msbuild executable is only distributed with Visual Studio. On the build server is the web project actually being built? That there is no output folder suggests it is not being built. Also note that package.config and PackageReference don't mix and can't be used together for the same project. – Jonathan Dodds Commented Feb 2 at 15:25
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布评论

评论列表(0)

  1. 暂无评论