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.

Unable to specify project file to analyze

See original GitHub issue

On 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Pycoraxcommented, Feb 5, 2021

Thanks for the fix! I can verify that it works as expected.

1reaction
JoeRobichcommented, Feb 5, 2021

@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 of dotnet format.

D:\project-folder\> dotnet-format --check "D:\project-folder\project-to-analyze.csproj" -v diagnostic --fix-style warn --report "D:\project-folder\report.json"

@wli3 Should dotnet tools be invokable through the dotnet CLI from within folders containing multiple project files?

Steps to reproduce:

dotnet tool install -g dotnet-format
dotnet new console -o project-folder
cd project-folder
cp project-folder.csproj project-to-analyze.csproj
dotnet format project-to-analyze.csproj
Read more comments on GitHub >

github_iconTop 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 >

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