Get build errors if a solution is missing references #10780
Unanswered
AlexanderRydberg
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need some advice. We have a monorepo with many .csproj files and solutions. Long story short, both scenarios involve the \bin\ and \obj\ folders being wiped from all projects.
If I build a solution with MSBuild, it builds fine:
msbuild.exe D:\Github\yyy\project\solution.sln /t:Restore;Build /m /p:Configuration=Release
However, when I build the same solution in Visual Studio 2022, I get the following error:
Severity: Error
Code: NU1105
Description: Unable to find project information for 'D:\GitHub\xxx\project\project.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution, so try running a restore from the command line. Otherwise, the project file may be invalid or missing targets required for restore.
This error indicates that the .csproj file is missing from the solution, and someone needs to add the missing project. We would like to have a way to be alerted when a project is missing from a solution.
How would one go about making this happen?
My initial thought was to add some arguments to MSBuild that would cause it to fail if a solution is missing a reference, but I haven't been able to make MSBuild produce a build error in this case. Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions