Skip to content

Commit cf6a39f

Browse files
committed
Replace custom MSBuild targets with improved documentation
Fixes #1788
1 parent 6cc07c4 commit cf6a39f

6 files changed

Lines changed: 34 additions & 17 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Settings/SettingsFileCodeFixProvider.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ internal class SettingsFileCodeFixProvider : CodeFixProvider
2525
{
2626
private const string StyleCopSettingsFileName = "stylecop.json";
2727
private const string DefaultSettingsFileContent = @"{
28+
// ACTION REQUIRED: This file was automatically added to your project, but it
29+
// will not take effect until additional steps are taken to enable it. See the
30+
// following page for additional information:
31+
//
32+
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md
33+
2834
""$schema"": ""https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json"",
2935
""settings"": {
3036
""documentationRules"": {

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
<None Include="..\stylecop.json">
151151
<Link>stylecop.json</Link>
152152
</None>
153-
<None Include="build\StyleCop.Analyzers.targets" />
154153
<None Include="packages.config" />
155154
<NuGetManifest Include="StyleCop.Analyzers.nuspec">
156155
<SubType>Designer</SubType>

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
<file src="tools\install.ps1" target="tools\" />
2929
<file src="tools\uninstall.ps1" target="tools\" />
3030

31-
<!-- MSBuild imports -->
32-
<file src="build\StyleCop.Analyzers.targets" target="build\" />
33-
3431
<!-- Source code -->
3532
<file src="..\StyleCop.Analyzers\**\*.cs" exclude="..\StyleCop.Analyzers\obj\**\*.cs" target="src"/>
3633
<file src="**\*.cs" exclude="obj\**\*.cs;Properties\AssemblyInfo.cs" target="src"/>

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/build/StyleCop.Analyzers.targets

Lines changed: 0 additions & 13 deletions
This file was deleted.

StyleCopAnalyzers.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ EndProject
3434
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentation", "{19DD9E9D-877A-4492-9B7F-2E681DD58308}"
3535
ProjectSection(SolutionItems) = preProject
3636
documentation\Configuration.md = documentation\Configuration.md
37+
documentation\EnableConfiguration.md = documentation\EnableConfiguration.md
3738
documentation\SA1000.md = documentation\SA1000.md
3839
documentation\SA1001.md = documentation\SA1001.md
3940
documentation\SA1002.md = documentation\SA1002.md
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Enabling **stylecop.json**
2+
3+
At this time, the code fix is not able to fully configure the newly-created **stylecop.json** file for use. This is
4+
tracked in bug report [dotnet/roslyn#4655](https://github.com/dotnet/roslyn/issues/4655). In the mean time, users must
5+
manually perform the following additional steps after creating the **stylecop.json** file.
6+
7+
1. Right click the project in **Solution Explorer** and select **Unload Project**. If you are asked to save changes,
8+
click **Yes**.
9+
2. Right click the unloaded project in **Solution Explorer** and select **Edit *ProjectName*.csproj**.
10+
3. Locate the following item in the project file.
11+
12+
```csharp
13+
<None Include="stylecop.json" />
14+
```
15+
16+
4. Change the definition to the following.
17+
18+
```csharp
19+
<AdditionalFiles Include="stylecop.json" />
20+
```
21+
22+
5. Save and close the project file.
23+
6. Right click the unloaded project in **Solution Explorer** and select **Reload Project**.
24+
25+
## Next steps
26+
27+
Additional information about the content of **stylecop.json** is available in [Configuration.md](Configuration.md).

0 commit comments

Comments
 (0)