microsoft / CsWinRT

C# language projection for the Windows Runtime
MIT License
554 stars 107 forks source link

VS designer build errors with NetProjectionSample #1056

Open angelazhangmsft opened 2 years ago

angelazhangmsft commented 2 years ago

Describe the bug

When opening the NetProjectionSample (CppWinRTComponentProjectionSample.sln) in Visual Studio, errors like the following appear in VS:

(1) Error Path 'C:\Users\deads\Desktop\Dev\CsWinRT-master\src\Samples\Net5ProjectionSample_build\x64\Debug\SimpleMathComponent\bin\SimpleMathComponent\SimpleMathComponent.winmd' is not a file or directory SimpleMathProjection C:\Users\deads\Desktop\Dev\CsWinRT-master\src\Samples\Net5ProjectionSample\SimpleMathProjection\EXEC 1

(2) Error MSB3073 The command ""C:\Users\deads.nuget\packages\microsoft.windows.cswinrt\1.4.1\cswinrt.exe" @"C:\Users\deads\Desktop\Dev\CsWinRT-master\src\Samples\Net5ProjectionSample_build\x64\Debug\SimpleMathProjection\bin\cswinrt.rsp"" exited with code 1. SimpleMathProjection C:\Users\deads.nuget\packages\microsoft.windows.cswinrt\1.4.1\build\Microsoft.Windows.CsWinRT.targets 121

These errors don't prevent the projection from building successfully, but they still show up in VS Error List after building. The errors disappear if you close/reopen the solution after building, probably since the designer build happens once upon opening the solution in VS.

To Reproduce

  1. Open NetProjectionSample (CppWinRTComponentProjectionSample.sln) in VS 2022. Make sure to clear any previous output
  2. Errors appear
  3. Build the solution, and the errors still show. MicrosoftTeams-image

Expected behavior

No errors

Version Info

CsWinRT 1.4.1 (also see the errors with 1.3.5) .NET SDK 6.0.100 VS 2022 CppWinRT 2.0.210806.1 and 2.0.211028.7

Additional context

Related to this target: https://github.com/microsoft/CsWinRT/blob/b216a3854af21aa003cd3ddc19bc4b982e843b40/nuget/Microsoft.Windows.CsWinRT.targets#L121

angelazhangmsft commented 2 years ago

Need to check if fixed by #1105

angelazhangmsft commented 2 years ago

Using latest internal build I still see the following warnings before building:

image