UFO ET IT

VS2015 : 경고 MSB3884 : 규칙 집합 파일을 찾을 수 없습니다.

ufoet 2020. 11. 30. 20:26
반응형

VS2015 : 경고 MSB3884 : 규칙 집합 파일을 찾을 수 없습니다.


WinForms VS2013 프로젝트를 VS2015로 업그레이드 한 후 MSB3884 "규칙 집합 파일을 찾을 수 없습니다"라는 경고가 표시되기 시작했습니다.

Google 검색에서 하나의 MSDN 기사가 나타 났는데, Stack Overflow 기사와 수많은 다른 사이트가이 기사를 가리 킵니다.

비슷한 질문 : 33020507 MSDN : VS2015 MSB3884 경고

VS2013과 VS2015가 모두 설치되어 있습니다.

경고를 제공하는 프로젝트 파일 (및 그렇지 않은 파일)에는 이러한 항목이 없습니다.

<CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories> 

프로젝트 파일에서 다른 두 항목을 삭제하면 규칙 파일 세트가 없기 때문에 문제가 해결됩니다.

<CodeAnalysisIgnoreBuiltInRuleSets> 
<CodeAnalysisIgnoreBuiltInRules>

msbuild를 사용하여 외부에서 빌드하려고하지만 VS2015도 문제를 표시하는 경향이 있습니다.

흥미롭게도 프로젝트 속성 코드 분석기 영역에서 열기 버튼을 클릭하면 파일을 얻습니다.

다른 규칙 세트를 지정해도 차이가 없습니다. 그것은 내가 생각할 수있는 환경 변수 설정이 아니라고 생각하게 만듭니다. 코드 분석기는 프로젝트 파일의 기능입니다. 디렉토리 속성을 추가 할 수 있지만 합의는 경로 인 <CodeAnalysisRule*Directories>.

GUI는 기본값을 사용합니다.

VS2015 프로젝트 속성 코드 분석 탭'

다음은 일반적인 프로젝트 파일 조각입니다.

  <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>

프로젝트 파일에서 코드 분석 줄을 제거하지 않고 프로젝트 파일을 다시 저장하면 다시 추가 할 수 있지만 경고를 제거 / 수정하려면 어떻게해야합니까?


VS2013에서 VS2015로 업그레이드 한 후 동일한 문제가 발생했습니다.

내 솔루션은 다음과 같습니다.

  1. 프로젝트 속성에서 코드 분석 섹션으로 이동합니다.
  2. 규칙 세트 목록에서 찾아보기 옵션을 선택하십시오. 여기에 이미지 설명 입력
  3. Browse to the VS2015 rule sets folder. C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets
  4. Pick a rule set. The default used by new projects is: MinimumRecommendedRules.ruleset
  5. Rebuild. Check the warning has gone. 여기에 이미지 설명 입력

I hit this warning after migrating from VS 2013 to VS 2015 as well. In my case the error was Could not find rule set file "AllRules.ruleset". The fix for me was to change the VisualStudioVersion setting in the .csproj file to be 14.0 so that it looks in the correct rule set folder:

VisualStudioVersion 설정

After that and a rebuild, the warning was resolved. Much easier.


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

<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>

became

<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>

(Jon Shadforth's answer also worked for me, but I didn't like adding the path to more projects - as timB33 commented)


I got rid of this warning by setting <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>


I spent some time looking at the different solutions proposed here - they each had good elements but each required some adjustments. I found a clean solution to be:

Locate an existing or create a <PropertyGroup> element in the project file that has NO conditions (e.g configuration or platform) i.e that will apply to all configurations on all plateforms. To this elment add a <CodeAnalysisRuleSetDirectories> element specifying the relative path to the "Rule Set" directory from the current dev env directory. E.g:

<PropertyGroup>
    <CodeAnalysisRuleSetDirectories>$(DevEnvDir)\..\..\Team Tools\Static Analysis Tools\Rule Sets</CodeAnalysisRuleSetDirectories>
</PropertyGroup>

Had this when compiling a solution upgraded from VS2015 to VS2017 but had MSBuild 14 in the path (C:\Program Files (x86)\MSBuild\14.0\Bin). Changed to ensure 15 was in the path (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin) and all worked.


I had this error on my build server which has Visual Studio Build Tools on it rather than Visual Studio.

The solution for me was to use the installer to enable Static analysis tools in the individual components list.

참고 URL : https://stackoverflow.com/questions/33637211/vs2015-warning-msb3884-could-not-find-rule-set-file

반응형