question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use with dotnet cli and csproj?

See original GitHub issue

The current instructions for using the dotnet cli use a project.json and not a csproj.

I’ve tried to get csproj to work with stylecop.json but it seems to have no effect.

dotnet-test.csproj

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>netcoreapp2.0</TargetFramework>
		<CodeAnalysisRuleSet>./dotnet-test.ruleset</CodeAnalysisRuleSet>
	</PropertyGroup>
	<ItemGroup>
		<!-- No effect. No error on bad path. -->
		<AdditionalFile Include="./stylecop.json" />
		<AdditionalFiles Include="$(SolutionDir)/stylecop.json" Link="stylecop.json" />
	</ItemGroup>
	<ItemGroup>
		<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
	</ItemGroup>
</Project>

dotnet-test.ruleset

<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="The Rules" ToolsVersion="10.0">
	<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
		<Rule Id="SA1652" Action="None" /> <!-- Don't use XML documentation -->
		<Rule Id="SA1633" Action="None" /> <!-- No file header -->
	</Rules>
</RuleSet>

stylecop.json

{
	"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
	"settings": {
		"indentation": {
			"useTabs": true
		}
	}
}
Intentional parse error -- no effect

Program.cs

// This file uses tabs
using System;

public class Program
{
	public static void Main(string[] args)
	{
		Console.WriteLine("Hello World!");
	}
}

I’m still getting warning SA1027: Tabs must not be used errors. How do I configure this?

This issue is similar to #2028, but it doesn’t go away if I fix the parse error in stylecop.json.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
alexandru-calinoiucommented, Jul 26, 2017

Yes, of course a , 😦

0reactions
alexandru-calinoiucommented, Jul 26, 2017

Thanks for the reply @vweijsters

But it does not look like it:

{
    "$schema":
        "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json"
    "settings": {
        "documentationRules": {
            "documentInternalElements": false
        },
        "orderingRules": {
            "usingDirectivesPlacement": "outsideNamespace"
        }
    }
}

Am I missing something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet sln command - .NET CLI
The dotnet sln command provides a convenient way to list and modify projects in a solution file. Create a solution file. To use...
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code with one command.
Read more >
dotnet add reference command - .NET CLI
The dotnet add reference command provides a convenient option to add project-to-project references.
Read more >
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >
dotnet new <TEMPLATE> - .NET CLI
The dotnet new command creates new .NET projects based on the specified template.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found