You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it says on the tin, dotnet format should probably have an implicit call to dotnet restore or at least document this as a best practice. This would mimic behavior of other dotnet tools such as build, test, and package which will often perform implicit actions (such as restore or even build)
What is especially insidious is that if the package in question is in your NuGet Global Cache you won't realize something is broken until it ends up in the CI (such as GitHub Actions which will spin up a throw away container each time).
Here's the example I encountered:
2020-10-25T00:34:27.6648905Z Formatting code files in workspace '/home/runner/work/VisualStudioSolutionSorter/VisualStudioSolutionSorter/VisualStudioSolutionSorter.sln'.
2020-10-25T00:34:32.4405953Z VisualStudioSolutionSorter.Tests/GlobalAssemblyConfiguration.cs(9,12): The type or namespace name 'ParallelizableAttribute' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
2020-10-25T00:34:32.4411366Z VisualStudioSolutionSorter.Tests/GlobalAssemblyConfiguration.cs(9,12): The type or namespace name 'Parallelizable' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
2020-10-25T00:34:32.4461340Z VisualStudioSolutionSorter.Tests/GlobalAssemblyConfiguration.cs(9,27): The name 'ParallelScope' does not exist in the current context (CS0103)
2020-10-25T00:34:32.4464640Z VisualStudioSolutionSorter.Tests/GlobalAssemblyConfiguration.cs(7,7): The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?) (CS0246)
.
. TRUNCATED FOR REPORT
.
2020-10-25T00:34:32.4580314Z Formatted code file '/home/runner/work/VisualStudioSolutionSorter/VisualStudioSolutionSorter/VisualStudioSolutionSorter.Tests/IntegrationTests.cs'.
2020-10-25T00:34:32.4581444Z Format complete in 4781ms.
This project is using the NUnit Unit Test Framework for its integration testing, this is a pretty popular package (at least on my machine) so it has long lived in my NuGet Global Cache.
To work around this issue perform an explicit restore like so (in GitHub Actions):
# Restore any NuGet Packages Used by this Project
- name: Restore Packagesrun: dotnet restore# Verify that the code is formatted correctly
- name: Format Filesrun: dotnet format --fix-style warn --fix-analyzers warn --check
As it says on the tin,
dotnet format
should probably have an implicit call todotnet restore
or at least document this as a best practice. This would mimic behavior of otherdotnet
tools such asbuild
,test
, andpackage
which will often perform implicit actions (such as restore or even build)What is especially insidious is that if the package in question is in your NuGet Global Cache you won't realize something is broken until it ends up in the CI (such as GitHub Actions which will spin up a throw away container each time).
Here's the example I encountered:
This project is using the NUnit Unit Test Framework for its integration testing, this is a pretty popular package (at least on my machine) so it has long lived in my NuGet Global Cache.
To work around this issue perform an explicit restore like so (in GitHub Actions):
Currently using this version:
Thank you for this amazing tool, this is a goldmine for the CI junkies like myself!
The text was updated successfully, but these errors were encountered: