生成错误,该项目引用了NuGet [英] Build error, This project references NuGet

查看:114
本文介绍了生成错误,该项目引用了NuGet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试构建解决方案时,收到以下错误消息:

When I try to build my solution, I get the following error message:


严重性代码说明项目文件行抑制状态
错误此项目引用此计算机
上缺少的NuGet软件包。使用NuGet软件包还原下载它们。有关
的更多信息,请参见 http://go.microsoft.com/fwlink/? LinkID = 322105
丢失的文件是
..\packages\Microsoft.Net.Compilers.1.1.1\build\Microsoft.Net.Compilers.props。 MusicKarma C:\Users\Bryan\Documents\Visual
Studio 2015\Projects\MusicKarma\MusicKarma.csproj 268

Severity Code Description Project File Line Suppression State Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.1.1\build\Microsoft.Net.Compilers.props. MusicKarma C:\Users\Bryan\Documents\Visual Studio 2015\Projects\MusicKarma\MusicKarma.csproj 268

当我在 packages文件夹中查看时,我发现名为Microsoft.Net.Compilers.props的文件

When I look In my packages folder, I can find I file named Microsoft.Net.Compilers.props

我尝试使用Nuget Restore,

I have tried to use Nuget Restore, but it keeps saying that I have all the packages.

当我将这个项目从TFS转移到我的一台计算机上时,就会发生这种情况。

This happens when I take this project from TFS to one of my computers.

推荐答案

首先,我将检查您的MusicKarma项目的packages.config文件中是否包含Microsoft.Net.Compilers。如果不是,那么您可以从MusicKarma.csproj中删除与该NuGet包有关的所有内容。

First I would check if your MusicKarma project has Microsoft.Net.Compilers in its packages.config file. If not then you could remove everything to do with that NuGet package from your MusicKarma.csproj.

如果您使用的是Microsoft.Net.Compilers NuGet包,那么我的猜测是路径不正确。在错误消息中查看目录名称,我猜想MusicKarma解决方案文件(.sln)与MusicKarma.csproj位于同一目录中。如果是这样,则packages目录可能是错误的,因为默认情况下,packages目录将位于解决方案目录中。因此,我假设您的软件包目录为:

If you are using the Microsoft.Net.Compilers NuGet package then my guess is that the path is incorrect. Looking at the directory name in the error message I would guess that the MusicKarma solution file (.sln) is in the same directory as the MusicKarma.csproj. If so then the packages directory is probably wrong since by default the packages directory would be inside the solution directory. So I am assuming that your packages directory is:

C:\Users\Bryan\Documents\Visual Studio 2015\Projects\MusicKarma\packages

而您的MusicKarma.csproj文件正在寻找道具文件在:

Whilst your MusicKarma.csproj file is looking for the props file in:

C:\Users\Bryan\Documents\Visual Studio 2015\Projects\packages\Microsoft.Net.Compilers.1.1.1\build

因此,如果是这种情况,则可以通过编辑MusicKarma.csproj文件中的路径或重新安装NuGet包来解决此问题。

So if that is the case then you can fix the problem by editing the path in your MusicKarma.csproj file or by reinstalling the NuGet package.

这篇关于生成错误,该项目引用了NuGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆