aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Publish .NET Core app with shared project with spaces in name. Misleading error message: net6.0\browser-wasm\ref or net6.0\win-x64\ref not found

Open vsfeedback opened this issue 3 years ago • 0 comments

This issue has been moved from a ticket on Developer Community.


Ridiculously misleading error message caused by blank spaces in the shared project path. This issue is NOT about the blank spaces in the path (there are other issues listed at the end tracking that one) but because of the message being generated.

To reproduce create Blazor WASM project (Not ASP .NET Hosted) in Visual Studio (version 7.3.5 at this time with .NET Core SDK 6.0.401). Make sure the project is on path without spaces and the project name is without spaces e.g.

  • solution file C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\BlazorApp1.sln
  • and project file C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\BlazorApp1\BlazorApp1.csproj Publish the project to IIS. So far nothing unusual and everything works fine. Add Class Library project 'SharedModels1' to the solution: C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\SharedModels1\SharedModels1.csproj In the BlazorApp1 project add reference to the SharedModels1 project. Publish the BlazorApp1 project again. Everything still works fine. Add second Class Library project 'Shared Models 2' to the solution. Notice the blank spaces in the name. The path would be C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\Shared Models 2\Shared Models 2.csproj In the BlazorApp1 project add reference to the Shared Models 2 project. Publish the BlazorApp1 project again. Failing this time with Warning and Error. Warning Reference assembly C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\Shared Models 2\bin\Release\net6.0\browser-wasm\Shared Models 2.dll could not be found. This is typically caused by build errors in referenced projects. Error Metadata file 'C:\Projects\VisualStudio2022NoSpaces\BlazorApp1\Shared Models 2\obj\Release\net6.0\browser-wasm\ref\Shared Models 2.dll' could not be found BlazorApp1

Every developer at this point is on wild goose chase, looking for the ...\bin\Release\net6.0\browser-wasm and obj\Release\net6.0\browser-wasm\ref folders. But they don't exist. So it is not that the build process cannot find the browser-wasm subfolder but is breaks on the 'Shared Models 2' subfolder because of the spaces. The browser-wasm is taken from the Target Runtime on the Publish profile and plugged in that error mesage path. Same issue happens on ASP Core app with shared project with spaces in the name, when published as any other Target Runtime than 'Portable' e.g. win-x64. If the message reads that 'Models 2\obj\Release\net6.0...' is not found or such parameter to a command is not valid it would be a clue that there is something wrong with the path.

I know there are few other issues already tracking the space is path issue: https://github.com/dotnet/sdk/issues/26061 https://github.com/dotnet/sdk/issues/26061 and https://developercommunity.visualstudio.com/t/WASM-publish-fails-if-path-contains-spac/10087679?entry=problem&ref=native&refTime=1664979407322&refUserId=ae8758e5-350a-6d46-8bc7-ff11d7395c17

But again, this issue is not about the space itself but the error message being so misleading.


Original Comments

Feedback Bot on 10/7/2022, 07:19 PM:

(private comment, text removed)

Peng Ge [MSFT] on 10/11/2022, 08:06 PM:

(private comment, text removed)

Stefan Dimov on 10/13/2022, 10:52 AM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Oct 14 '22 17:10 vsfeedback