After upgrading my WinForms VS2013 project to VS2015, I started seeing the MSB3884 "Could not find rule set file" warning.
A Google search turned up one MSDN article, which a Stack Overflow article points to as well as numerous other sites.
Similar Question: 33020507 MSDN: VS2015 MSB3884 Warning
I have both VS2013 and VS2015 installed.
The project files giving the warnings (and those that do not), do not have these entries.
<CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>
If I delete the other two entries from the project file, then the problem goes away, which is obvious, as there is no rule file set.
<CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>
I am trying to build externally using msbuild, however VS2015 tends to show the problem too.
Interestingly enough, if I click on the open button in the project properties Code Analyzer area, I do get the file.
Specifying a different rule set makes no difference. That makes me think that possibly, there is an environment variable setting, not that any come to mind. Code Analyzers is a function of the project file. I can add a directory attribute, but the consensus is to take out paths, the <CodeAnalysisRule*Directories>
.
The GUI uses defaults:
Here is a typical project file fragment.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>BasicCorrectnessRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
Without getting rid of the Code Analysis lines from the project file, though saving a project file again would just add it back, how can I eliminate/fix the warning?
You said your project files giving off the warnings did not contain any
<CodeAnalysisRuleSetDirectories>
entry.Mine did not either, and like you I get the file if I click the Open button in the project properties Code Analysis section.
However, searching all project files in the solution turned up two projects which did have
<CodeAnalysisRuleSetDirectories>
tags, and those tags contained an older version of the Visual Studio reference in the path.Fixing those paths fixed my problem, and I've just confirmed that the project which was raising the error references a project which referenced the projects which contained the bad
<CodeAnalysisRuleSetDirectories>
entries.So search the whole solution and fix all
<CodeAnalysisRuleSetDirectories>
paths, or try removing them.In my case
became
(Jon Shadforth's answer also worked for me, but I didn't like adding the path to more projects - as timB33 commented)