.net - 如何解决找不到规则集文件 "ManagedMinimumRules.ruleset"错误

标签 .net powershell msbuild dotnet-cli dotnet-build

在此先致谢,非常感谢您的帮助!

我正在使用此代码 dotnet build E:\abc\abc.sln/p:Congiguration=Release 但它给出以下错误:

C:\Program Files\dotnet\sdk\5.0.201\Microsoft.CSharp.CurrentVersion.targets(135,9):警告 MSB3884:找不到规则集文件“ManagedMinimumRules.ruleset”。

此规则集 ManagedMinimumRules.ruleset 文件从 Microsoft.CSharp.CurrentVersion.targets 文件调用。

我看到目标文件第135行的代码如下:

<ResolveCodeAnalysisRuleSet
CodeAnalysisRuleSet="$(CodeAnalysisRuleSet)"
CodeAnalysisRuleSetDirectories="$(CodeAnalysisRuleSetDirectories)"
MSBuildProjectDirectory="$(MSBuildProjectDirectory)">
<Output TaskParameter="ResolvedCodeAnalysisRuleSet" PropertyName="ResolvedCodeAnalysisRuleSet" />
</ResolveCodeAnalysisRuleSet>

我已手动粘贴规则集文件,但仍然无法正常工作,请向我解释如何从目标文件中获取 CodeAnalysisRuleSet、CodeAnalysisRuleSetDirectories 路径。

最佳答案

要询问构建时属性值,请将 -bl 添加到您的 dotnet build 命令,安装 MSBuild Structured/Binary Log Viewer并使用它打开解决方案目录中的 msbuild.binlog 文件。然后,您可以搜索 CodeAnalysisRuleSet 以在构建期间找到将值分配给 CodeAnalysisRuleSetCodeAnalysisRuleSetDirectories 属性的点。

更新:另见 Troubleshoot and create logs for MSBuild problems在 Visual Studio 文档中。

关于.net - 如何解决找不到规则集文件 "ManagedMinimumRules.ruleset"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66983731/

相关文章:

c# - WPF 中的 HitTest

powershell - 使用 MSBuild 打包云服务项目时出现 CSPack RemotingException

c# - 无法将 System.Collections.Generic List<T> 转换为 T

powershell - Powershell core 7.1.2 或 7.2 的重音法语字符不起作用

sql-server - 如何使用输出和退出代码运行 SQL Server 代理 Powershell 脚本

powershell - 矢量粉碎保护已启用PowerShell PowerShell

msbuild - 如何更改 NuGet 包中的目标文件名?

.net - 如何使用完全独立的 .NET 3.5 sp1 安装程序制作 WiX 安装程序?

c# - 扩展方法何时中断?

c# - NHibernate 多对多映射不起作用