- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
将某些 NuGet 包添加到项目时,有时 .csproj 文件的第一个属性组中会出现一个奇怪的项目。
<PropertyGroup>
...
<NuGetPackageImportStamp>3d051ef3</NuGetPackageImportStamp>
</PropertyGroup>
标记每次都不同,并且看起来不连续。
我找不到任何对 <NuGetPackageImportStamp>
的引用在 NuGet 文档中。它的用途是什么?它是如何工作的?有必要吗?
每次都会添加此内容的一个包是 StyleCop.MSBuild ,至少在当前的 4.7.49 版本中是这样。只需将该包添加到新项目中,您就会看到这个神秘项目出现在您的项目文件中。
最佳答案
NuGetPackageImportStamp 是 Visual Studio 2013 及更高版本无法检测 NuGet 包添加或删除 MSBuild 导入的解决方法。
旧版本的 Visual Studio 不需要此解决方法。即使在 Visual Studio 2013 中,也可以安全地删除该属性:如果关闭并重新打开解决方案,Visual Studio 将重新加载导入的 MSBuild 目标。
NuGet source code显示当包添加或删除 MSBuild 导入时,NuGet 会添加此属性。它每次都使用新的 GUID。 Visual Studio 2013 检测到项目已更改并提供重新加载。仅添加或删除 MSBuild 导入不足以让 Visual Studio 2013 了解项目在运行时已更改,这正是 NuGet 通过此解决方法解决的问题。
StyleCop.MSBuild NuGet 包包含自定义 MSBuild 目标,因此添加或删除此 NuGet 包将导致添加此属性。
<小时/>更新:Matt Ward's comment是正确且重要的。
There is still code in NuGet that adds the NuGet package stamp and the code no longer checks for Visual Studio 2013.
以下是我的底线建议:
<NuGetPackageImportStamp>
指令,然后将其添加到旧的损坏的 csproj 中,看看是否可以解决问题; 无论您使用的是哪个 Visual Studio 版本。<TargetFrameworkProfile>
指示。它存在于您的新工作 csproj 中吗?考虑删除它。关于.net - NuGetPackageImportStamp 的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24049961/
将某些 NuGet 包添加到项目时,有时 .csproj 文件的第一个属性组中会出现一个奇怪的项目。 ... 3d051ef3 标记每次都不同,并且看起来不连续。 我找不到任何对 的引用
我是一名优秀的程序员,十分优秀!