dotnet / dotnet/format

--fix-style warn --check unable to find Nuget packages

Open
#1,061 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

I am running format check by running following command `dotnet-format ./MySolution.sln --fix-style warn --check` . This solution contains few c# and c++ projects. I am using .editorconfig provided with this repository(dotnet/format) filtered only for [.cs] with severity set to warn for all rule. I have added reference of few Nuget packages to my .csproj as follow.

![image](https://user-images.githubusercontent.com/53044446/112421180-9b777a80-8d54-11eb-945d-544f4ed1de4b.png)

**After Running the above command to check style format, getting following warnings.**

> ContextInfo.cs(22,14): The type or namespace name 'JsonPropertyName' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
ContextInfo.cs(25,14): The type or namespace name 'JsonPropertyNameAttribute' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
ContextInfo.cs(25,14): The type or namespace name 'JsonPropertyName' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
JsonWriter.cs(12,24): The name 'JsonSerializer' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(10,57): The name 'NLog' does not exist in the current context (CS0103)
FileCompressorUtility.cs(27,42): The name 'ZipFile' does not exist in the current context (CS0103)
FileCompressorUtility.cs(27,64): The name 'ZipArchiveMode' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(28,34): The type or namespace name 'NLog' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
DotNetUtilities\LoggerUtility\NLogLoggerUtility.cs(29,35): The type or namespace name 'NLog' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
NLogLoggerUtility.cs(39,40): The name 'NLog' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(54,17): The name 'NLog' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(59,17): The name 'NLog' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(64,17): The name 'NLog' does not exist in the current context (CS0103)
NLogLoggerUtility.cs(65,17): The name 'NLog' does not exist in the current context (CS0103)

all these warnings are related to the Nuget package I have referenced in csproj. All the projects are successfully building and with no warnings shown in the visual studio 2019. I have also restored all the packages before running the fix-style using command `msbuild -t:restore` tried `dotnet restore` as well. I think I have used the correct directives and added the assembly reference.
How to resolve this issue? I need to suppress/Remove these warnings as they are failing in CI.

.net Framework version: 4.8
.net core version: 5.0.104
dotnet-format version:5.0.211103+b95e1694941ca2595941f1c9cd0d9727b6c53d43

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.