msbuild: Unexpected warning/error MSB3202
Attachment
Visual Studio Version
Visual Studio 2022 (17.7.6)
Summary
- Building project, unexpected warning message:
..\Microsoft.Common.CurrentVersion.targets(1797,5): warning MSB3202: The project file "xxx.csproj" was not found. - In more large and complex solution, randomly showing the same MSB3202 message but as error and failed to build
Steps to Reproduce
- Open the solution in attachment file
- Build the
CompanyName.OrganizationName.PackageName.Hardwareproject - Open and save
Class1.csin the project - Build the project again
- Repeat steps 3 to 4, warning MSB3202 is shown in the output window
Build started...
1>------ Build started: Project: CompanyName.OrganizationName.PackageName.Hardware, Configuration: Debug Any CPU ------
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\arm64\Microsoft.Common.CurrentVersion.targets(1797,5): warning MSB3202: The project file "..\..\OtherCompanyName.OrganizationName.PackageName\Network\OtherCompanyName.OrganizationName.PackageName.Network.Connection\OtherCompanyName.OrganizationName.PackageName.Network.Connection.csproj" was not found.
1>Done building project "CompanyName.OrganizationName.PackageName.Network.Communication.IO.csproj".
1>CompanyName.OrganizationName.PackageName.Hardware -> C:\ProjectNotFound\CompanyName.OrganizationName.PackageName\CompanyName.OrganizationName.PackageName.Hardware\bin\Debug\net7.0\CompanyName.OrganizationName.PackageName.Hardware.dll
========== Build: 1 succeeded, 0 failed, 4 up-to-date, 0 skipped ==========
========== Build started at 7:57 PM and took 01.367 seconds ==========
Expected Behavior
- Build succeeded without any warning/error MSB3202 message because project file(s) does exist
Actual Behavior
- Unexpected warning/error MSB3202
User Impact
- Failed to build if error MSB3202 is shown
Notes
- This problem can be found in Visual Studio 2019 also
- If we use
dotnet buildormsbuildcommand to build the project with the same steps, no warning/error MS3202 is shown - If we set
Maximum number of parallel project buildsto 1, no warning/error MS3202 is shown in Visual Studio - If we disable
BuildInParallelinCompanyName.OrganizationName.PackageName.Hardwareproject, no warning/error MS3202 is shown in Visual Studio - If we unchecked
Don't call MSBuild if a project appears to be up to date, no warning/error MS3202 is shown in Visual Studio - If we enable
DisableFastUpToDateCheckinCompanyName.OrganizationName.PackageName.Network.BuilderandCompanyName.OrganizationName.PackageName.Network.Communication.IOprojects, no warning/error MS3202 is shown in Visual Studio - This issue seems to be related to long path issue
- Set
LongPathsEnabled = 1in registry does not help
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (9 by maintainers)
@drewnoakes @melytc any further thoughts or updates here? Been running into the same thing.
I think I found it. There is a check for file existence: https://github.com/dotnet/msbuild/blob/7cf66090a764f0f239671e4877255efe7ba91155/src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/MSBuild.cs#L343
… and this abstraction calls https://github.com/dotnet/msbuild/blob/7cf66090a764f0f239671e4877255efe7ba91155/src/Framework/NativeMethods.cs#L1837
… which returns
false.System.IO.File.Existsreturnstruefor the same path. If we will get rid of this P/Invoke (https://github.com/dotnet/msbuild/pull/9223#issuecomment-2217451762) then it should resolve this issue.It still doesn’t explain why is this happening on MacOS. I guess it’s a different issue, because the
FileExistsWindowsis Windows only implementation 😃I tried to repro by using Archie’s solution, and I can confirm it’s reproable (pretty consistently) on VS 17.10.5. I see warnings in Output Window, but not in Error List. If it’s really reproable also with Rider on MacOS, it could be some weird MSBuild issue. I will assign myself for further investigation, but as this issue is not blocking, I will probably get to it in September (earliest).
@drewnoakes Can you please provide a link to the issue under MSBuild so those of us interested can follow it?