From cf6a39f2ea5e1efd0dfebac21c9283291edd92ec Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 18 Nov 2015 11:21:03 -0600 Subject: [PATCH] Replace custom MSBuild targets with improved documentation Fixes #1788 --- .../Settings/SettingsFileCodeFixProvider.cs | 6 +++++ .../StyleCop.Analyzers.CodeFixes.csproj | 1 - .../StyleCop.Analyzers.nuspec | 3 --- .../build/StyleCop.Analyzers.targets | 13 --------- StyleCopAnalyzers.sln | 1 + documentation/EnableConfiguration.md | 27 +++++++++++++++++++ 6 files changed, 34 insertions(+), 17 deletions(-) delete mode 100644 StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/build/StyleCop.Analyzers.targets create mode 100644 documentation/EnableConfiguration.md diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Settings/SettingsFileCodeFixProvider.cs b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Settings/SettingsFileCodeFixProvider.cs index 1dd3bf6b5..c2144aeea 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Settings/SettingsFileCodeFixProvider.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Settings/SettingsFileCodeFixProvider.cs @@ -25,6 +25,12 @@ internal class SettingsFileCodeFixProvider : CodeFixProvider { private const string StyleCopSettingsFileName = "stylecop.json"; private const string DefaultSettingsFileContent = @"{ + // ACTION REQUIRED: This file was automatically added to your project, but it + // will not take effect until additional steps are taken to enable it. See the + // following page for additional information: + // + // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md + ""$schema"": ""https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json"", ""settings"": { ""documentationRules"": { diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj index f521b9df5..6447b421a 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj +++ b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj @@ -150,7 +150,6 @@ stylecop.json - Designer diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec index ec1ab0cb7..240f28864 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec +++ b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec @@ -28,9 +28,6 @@ - - - diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/build/StyleCop.Analyzers.targets b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/build/StyleCop.Analyzers.targets deleted file mode 100644 index c40f7d907..000000000 --- a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/build/StyleCop.Analyzers.targets +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/StyleCopAnalyzers.sln b/StyleCopAnalyzers.sln index e1323a09b..e76f6be8d 100644 --- a/StyleCopAnalyzers.sln +++ b/StyleCopAnalyzers.sln @@ -34,6 +34,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentation", "{19DD9E9D-877A-4492-9B7F-2E681DD58308}" ProjectSection(SolutionItems) = preProject documentation\Configuration.md = documentation\Configuration.md + documentation\EnableConfiguration.md = documentation\EnableConfiguration.md documentation\SA1000.md = documentation\SA1000.md documentation\SA1001.md = documentation\SA1001.md documentation\SA1002.md = documentation\SA1002.md diff --git a/documentation/EnableConfiguration.md b/documentation/EnableConfiguration.md new file mode 100644 index 000000000..6680b14d7 --- /dev/null +++ b/documentation/EnableConfiguration.md @@ -0,0 +1,27 @@ +# Enabling **stylecop.json** + +At this time, the code fix is not able to fully configure the newly-created **stylecop.json** file for use. This is +tracked in bug report [dotnet/roslyn#4655](https://github.com/dotnet/roslyn/issues/4655). In the mean time, users must +manually perform the following additional steps after creating the **stylecop.json** file. + +1. Right click the project in **Solution Explorer** and select **Unload Project**. If you are asked to save changes, + click **Yes**. +2. Right click the unloaded project in **Solution Explorer** and select **Edit *ProjectName*.csproj**. +3. Locate the following item in the project file. + + ```csharp + + ``` + +4. Change the definition to the following. + + ```csharp + + ``` + +5. Save and close the project file. +6. Right click the unloaded project in **Solution Explorer** and select **Reload Project**. + +## Next steps + +Additional information about the content of **stylecop.json** is available in [Configuration.md](Configuration.md).