Skip to content

Commit 703c873

Browse files
committed
Update DotnetCli.md with VS2017 instructions
Update the documentation with details on how to enable StyleCop settings and custom ruleset on dotnet core 1.1.1 SDK 1.0.1 projects
1 parent bd8424c commit 703c873

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

documentation/DotNetCli.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ For this add the following to the dependencies section of the project.json file:
1313
"type": "build"
1414
}
1515
```
16-
16+
For VS2017 / dotnet core 1.1.1 SDK 1.0.1 projects edit the `.csproj` file and mark the `StyleCop.Analyzers` as `PrivateAssets`:
17+
```xml
18+
<ItemGroup>
19+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta001" PrivateAssets="All" />
20+
</ItemGroup>
21+
```
1722
If the project is restored and built right now this will already run the analyzers. A few extra steps are needed if they should be configured.
1823

1924
## Rulesets and stylecop.json
@@ -25,6 +30,18 @@ To supply a ruleset file and a stylecop.json configuration file to the compiler
2530

2631
**Note: ** `additionalArguments` is not currently defined in the schema but does exist and is passed during the build
2732

33+
On VS VS2017 / dotnet core 1.1.1 SDK 1.0.1 projects update `.csproj` as follows to apply settings and custom rules:
34+
```xml
35+
<PropertyGroup>
36+
...
37+
<CodeAnalysisRuleSet>stylecop.ruleset</CodeAnalysisRuleSet>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<None Remove="stylecop.json" />
41+
<AdditionalFiles Include="stylecop.json" />
42+
</ItemGroup>
43+
```
44+
2845
## Enabling xml documentation processing
2946

3047
All analyzers regarding xml documentation can only run if the xml processing is enabled. To do this add
@@ -34,3 +51,11 @@ All analyzers regarding xml documentation can only run if the xml processing is
3451

3552
to the `buildOptions` node of the project.json file. Note that this might cause additional CS1591 diagnostics to appear by the compiler.
3653
They can be suppressed in the ruleset file if necessary.
54+
55+
For VS VS2017 / dotnet core 1.1.1 SDK 1.0.1 projects update `.csproj`
56+
```xml
57+
<PropertyGroup>
58+
...
59+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
60+
</PropertyGroup>
61+
```

0 commit comments

Comments
 (0)