Unable to specify project file to analyze
See original GitHub issueOn both release version v4.0.130203 and development version v5.0.142902, it seems that attempting to use dotnet format in a folder with multiple csproj and sln files ignores the specified project file.
For example, using v5.0.142902 while Powershell is in the D:\username\Desktop
directory, using this command:
dotnet format --check "D:\project-folder\project-to-analyze.csproj" -v diagnostic --fix-style warn --report "D:\project-folder\report.json"
Gives the intended result with proper analysis. However, using this same command in the D:\project-folder\
directory, I get a result of:
Specify which project file to use because this 'D:\project-folder' contains more than one project file.
The same happens using v4.0.130203 with the following command (--fix-style warn
is removed as that is not present prior to v5):
dotnet format --check "D:\project-folder\project-to-analyze.csproj" -v diagnostic --report "D:\project-folder\report.json"
I’m not sure if this is a bug or if I am using the commands wrongly.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Specify which project file to use when inside project directory
Tried use -p / --p and point to the .csproj file / directory - still same error. Using .NET CORE, MVC project, Latest...
Read more >MSB4025: The project file could not be loaded. {0} - MSBuild
This error occurs when MSBuild tries to load and parse a solution file and create a project, but the project file could not...
Read more >NuGet Error NU1105
Unable to read project information for 'ProjectFile'. The project file may be invalid or missing targets required for restore.
Read more >How to prevent the error "Unable to read the project file .. ...
Problem was caused by read-only files, probably the visual studio solution, projects and user files. The only files that should be added to ......
Read more >Error: Failed to save Project to
Cause. The file is saved in a cloud storage service such as Microsoft OneDrive. The project file is corrupt.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the fix! I can verify that it works as expected.
@Pycorax I was able to reproduce this behavior on Windows. Thanks for sharing the error message again. This message is coming from the dotnet CLI and not dotnet-format.
This command works for me locally. Notice that I use
dotnet-format
instead ofdotnet format
.@wli3 Should dotnet tools be invokable through the dotnet CLI from within folders containing multiple project files?
Steps to reproduce: