diff options
author | Matt Ward <matt.ward@microsoft.com> | 2020-01-02 16:25:58 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@microsoft.com> | 2020-01-02 16:41:25 +0300 |
commit | 9161a9aa6a9c8cea7aa732444e5b72190b1d2701 (patch) | |
tree | 00db2d882e290fc23a1bac00a4c59bd7fb4d38b2 /main/tests/test-projects | |
parent | 988a29d6302ead741b57dc1a9a534a4af43f1fc6 (diff) |
[C#] Support CodeAnalysisRuleSet file
If the CodeAnalysisRuleSet MSBuild property points to a file then
the ruleset information is applied to the project configuration's
compilater options.
Fixes VSTS #1040606 - StyleCop rules are ignored
Fixes VSTS #577079 - [Diagnostics] Implement RuleSet file support
Diffstat (limited to 'main/tests/test-projects')
-rw-r--r-- | main/tests/test-projects/ruleset/custom.ruleset | 8 | ||||
-rw-r--r-- | main/tests/test-projects/ruleset/global.ruleset | 7 | ||||
-rw-r--r-- | main/tests/test-projects/ruleset/ruleset.csproj | 34 | ||||
-rw-r--r-- | main/tests/test-projects/ruleset/ruleset.sln | 17 |
4 files changed, 66 insertions, 0 deletions
diff --git a/main/tests/test-projects/ruleset/custom.ruleset b/main/tests/test-projects/ruleset/custom.ruleset new file mode 100644 index 0000000000..6411b72e21 --- /dev/null +++ b/main/tests/test-projects/ruleset/custom.ruleset @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<RuleSet Name="CustomTestRules" ToolsVersion="16.0"> + <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> + <Rule Id="SA1000" Action="Error" /> + <Rule Id="SA1001" Action="Warning" /> + <Rule Id="SA1002" Action="None" /> + </Rules> +</RuleSet>
\ No newline at end of file diff --git a/main/tests/test-projects/ruleset/global.ruleset b/main/tests/test-projects/ruleset/global.ruleset new file mode 100644 index 0000000000..b876fa315b --- /dev/null +++ b/main/tests/test-projects/ruleset/global.ruleset @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<RuleSet Name="Global Rules" ToolsVersion="16.0"> + <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> + <Rule Id="SA1000" Action="None" /> + <Rule Id="SA1003" Action="Error" /> + </Rules> +</RuleSet>
\ No newline at end of file diff --git a/main/tests/test-projects/ruleset/ruleset.csproj b/main/tests/test-projects/ruleset/ruleset.csproj new file mode 100644 index 0000000000..7b266eaccb --- /dev/null +++ b/main/tests/test-projects/ruleset/ruleset.csproj @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{2646A92D-26AB-4B3E-91A2-B73EC92FB064}</ProjectGuid> + <OutputType>Library</OutputType> + <RootNamespace>ruleset</RootNamespace> + <AssemblyName>ruleset</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <CodeAnalysisRuleSet>custom.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/main/tests/test-projects/ruleset/ruleset.sln b/main/tests/test-projects/ruleset/ruleset.sln new file mode 100644 index 0000000000..f44fc00c8a --- /dev/null +++ b/main/tests/test-projects/ruleset/ruleset.sln @@ -0,0 +1,17 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ruleset", "ruleset.csproj", "{2646A92D-26AB-4B3E-91A2-B73EC92FB064}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2646A92D-26AB-4B3E-91A2-B73EC92FB064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2646A92D-26AB-4B3E-91A2-B73EC92FB064}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2646A92D-26AB-4B3E-91A2-B73EC92FB064}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2646A92D-26AB-4B3E-91A2-B73EC92FB064}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
|