问题标签 [msbuild-15]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
218 浏览

c# - C# MSBuild 不包括 NuGet 包(适用于 Visual Studio 17)

我在我的 .csproj 文件中使用PackageReference并且我的构建在 Visual Studio (2017) 中工作。我正在使用 .net 4.5 构建我看过这个:

使用 jenkins 构建时,MSBuild 没有为 nuget PackageReference 添加 /reference

起初我在我们的构建服务器上遇到了问题,所以我在我的计算机上本地尝试了它。我先进行还原,然后再进行构建(或重建)。错误是:

(CoreCompile 目标)-> Properties\AssemblyInfo.cs(25,12):错误 CS0246:找不到类型或命名空间名称“log4net”(您是否缺少 using 指令或程序集引用?)

在我的项目中,我有

提前致谢。

更新

我创建了一个简单的解决方案/项目,其中仅包含一个 Nuget 包。我还使用最新的框架创建了它,以防与问题有关。同样,它在 VS2017 中构建,但使用 MSBuild 失败,.csproj 文件是

我验证了在恢复时文件被添加到项目 obj 文件夹以及 user/roaming/nuget 和 user/.nuget/packages。我收到与上述相同的错误消息。