.netpowershellmsbuilddotnet-clidotnet-build

How to resolve Could not find rule set file "ManagedMinimumRules.ruleset" error


Thanks in Advance, your help is greatly appreciated!

I am using this code dotnet build E:\abc\abc.sln /p:Congiguration=Release but it's giving error below error:

C:\Program Files\dotnet\sdk\5.0.201\Microsoft.CSharp.CurrentVersion.targets(135,9): warning MSB3884: Could not find rule set file "ManagedMinimumRules.ruleset".

This ruleset ManagedMinimumRules.ruleset file call from Microsoft.CSharp.CurrentVersion.targets files.

I see the code of target file line number 135 as below:

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

I have manually paste ruleset file but still doesn't work and Please explain me how to get CodeAnalysisRuleSet , CodeAnalysisRuleSetDirectories path from target file.


Solution

  • To interrogate build-time property values, add -bl to your dotnet build command, install MSBuild Structured/Binary Log Viewer and use it to open the msbuild.binlog file in the solution directory. You can then search for CodeAnalysisRuleSet to find the point(s) during the build when values were assigned to the CodeAnalysisRuleSet and CodeAnalysisRuleSetDirectories properties.

    Update: Also see Troubleshoot and create logs for MSBuild problems in the Visual Studio documentation.