dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.23k stars 9.95k forks source link

Having a space in project name for a hosted Blazor WebAssembly project breaks the build #39059

Closed TylerDM closed 9 months ago

TylerDM commented 2 years ago

Describe the bug

Adding a space to the name of a Blazor WASM front end for a Dotnet Core backend results in a failing build.

To Reproduce

Using the above steps I've created a repository that shows the issue at https://github.com/TylerDM/BlazorProjectsCantHaveSpacesInTheirName .

I only played with this path for a minute. But creating a new project with a space already in the name seems to prevent this issue. But creating without a space and adding one later, as I did, does not work properly.

Exceptions (if any)

build error ``` Conflicting assets with the same target path '_framework/blazor.boot.json'. For 'Build' assets 'Identity: C:\Users\user\source\repos\BlazorApp1\BlazorApp1\Client\bin\Debug\net6.0\wwwroot\_framework\blazor.boot.json, SourceType: Project, SourceId: BlazorApp1 Client, ContentRoot: C:\Users\user\source\repos\BlazorApp1\BlazorApp1\Client\bin\Debug\net6.0\wwwroot\, BasePath: /, RelativePath: _framework/blazor.boot.json, AssetKind: Build, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: BlazorWebAssemblyResource, AssetTraitValue: manifest, CopyToOutputDirectory: PreserveNewest, CopyToPublishDirectory: Never, OriginalItemSpec: obj\Debug\net6.0\blazor.boot.json' and 'Identity: C:\Users\user\source\repos\BlazorApp1\BlazorApp1\Client\bin\Debug\net6.0\wwwroot\_framework\blazor.boot.json, SourceType: Project, SourceId: BlazorApp1 Client, ContentRoot: C:\Users\user\source\repos\BlazorApp1\BlazorApp1\Client\bin\Debug\net6.0\wwwroot\, BasePath: /, RelativePath: _framework/blazor.boot.json, AssetKind: Build, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: BlazorWebAssemblyResource, AssetTraitValue: manifest, CopyToOutputDirectory: PreserveNewest, CopyToPublishDirectory: Never, OriginalItemSpec: obj\Debug\net6.0\blazor.boot.json'. BlazorApp1.Server C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets ```

Further technical details

dotnet --info Output ``` .NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\ Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc .NET SDKs installed: 3.1.416 [C:\Program Files\dotnet\sdk] 5.0.100 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] 5.0.210 [C:\Program Files\dotnet\sdk] 5.0.303 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] ```
TanayParikh commented 2 years ago

Hi @TylerDM, after you made those changes did you run dotnet clean and delete the bin and obj folders? If not, could you please try that out.

TylerDM commented 2 years ago

Hi @TylerDM, after you made those changes did you run dotnet clean and delete the bin and obj folders? If not, could you please try that out.

Already tried that, no change. I also tried deleting the .vs folder.

TanayParikh commented 2 years ago

I took a look a look at your project, I believe you're missing <AssemblyName>BlazorApp1.Client</AssemblyName> in BlazorApp1 Client.csproj, after you've added <RootNamespace>BlazorApp1.Client</RootNamespace>. Does this resolve your issue?

ghost commented 2 years ago

Hi @TylerDM. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

TylerDM commented 2 years ago

I took a look a look at your project, I believe you're missing <AssemblyName>BlazorApp1.Client</AssemblyName> in BlazorApp1 Client.csproj, after you've added <RootNamespace>BlazorApp1.Client</RootNamespace>. Does this resolve your issue?

This does prevent the error from occurring. Putting a space into the <AssemblyName> element results in the same error. Is this a supported scenario? If not, it would be helpful to emit a more specific error message during build when this mistake is made.

TanayParikh commented 2 years ago

But creating a new project with a space already in the name seems to prevent this issue. But creating without a space and adding one later, as I did, does not work properly.

Given this, I'd assume this is a supported scenario. Whats the difference in the csproj files between creating it with a space from the start vs adding a space after creation?

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

MackinnonBuck commented 9 months ago

Closing this out due to lack of community interest.