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.37k stars 9.99k forks source link

ClickOnce fails for BlazorWinFormsApp and BlazorWpfApp #31832

Closed Jinjinov closed 3 years ago

Jinjinov commented 3 years ago

Describe the bug

BlazorWinFormsApp and BlazorWpfApp have <Project Sdk="Microsoft.NET.Sdk.Razor"> and <TargetFramework>net6.0-windows</TargetFramework>

ClickOnce expects either <Project Sdk="Microsoft.NET.Sdk.Razor"> and <TargetFramework>net6.0</TargetFramework> or <Project Sdk="Microsoft.NET.Sdk"> and <TargetFramework>net6.0-windows</TargetFramework>

To Reproduce

Using .NET 6 Preview 3 and VS 16.10.0 Preview 2

Exceptions (if any)

The item "C:\Users...\source\repos...\obj\Release\net6.0-windows\apphost.exe" in item list "ContentWithTargetPath" does not define a value for metadata "TargetPath". In order to use this metadata, either qualify it by specifying %(ContentWithTargetPath.TargetPath), or ensure that all items in this list define a value for this metadata.

Further technical details


.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.3.21202.5
 Commit:    aee38a6dd4

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
  Version: 6.0.0-preview.3.21201.4
  Commit:  236cb21e3c

.NET SDKs installed:
  3.1.406 [C:\Program Files\dotnet\sdk]
  5.0.202 [C:\Program Files\dotnet\sdk]
  5.0.300-preview.21180.15 [C:\Program Files\dotnet\sdk]
  6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
  Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
  Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
  Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspN
etCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
  Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNe
tCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\sha
red\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
  Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
  Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore
.App]
  Microsoft.NETCore.App 3.1.14 [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.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.
App]
  Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\
Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.
WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.
WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.
WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.W
indowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.W
indowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\
shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
ghost commented 3 years ago

Thanks for contacting us. We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

TheCakeMonster commented 3 years ago

I think I've just run into this exception as well, while trying to use ClickOnce with a Mobile Blazor Bindings application. The exception shown in the build window in VS is as above, namely:

The item "C:\Users\Andrew\source\repos\DesiGen\src\UI\Windows\obj\Release\netcoreapp3.1\apphost.exe" in item list "ContentWithTargetPath" does not define a value for metadata "TargetPath". In order to use this metadata, either qualify it by specifying %(ContentWithTargetPath.TargetPath), or ensure that all items in this list define a value for this metadata.

I'm trying to use the publishing wizard to publish the Windows project that is created as part of the Hybrid Mobile Blazor Bindings template created by Eilon. My application targets .NET Core 3.1. I'm on VS 16.10 Preview 4, with the latest patches to .NET Core 3.1.

It looks like ClickOnce probably doesn't work for this scenario.

Pilchie commented 3 years ago

@NikolaMilosavljevic - any ideas here?

NikolaMilosavljevic commented 3 years ago

@John-Hart is this a supported ClickOnce publishing scenario?

TheCakeMonster commented 3 years ago

In order to try to narrow down the problem, I've created a new Hybrid Mobile Blazor Bindings app and attempted to publish that - and that also fails.

Repo can be found at https://github.com/TheCakeMonster/Examples/tree/master/Issues/BlazorHybridPublishFailure

Steps to reproduce:

  1. Install the Mobile Blazor Bindings template: dotnet new -i Microsoft.MobileBlazorBindings.Templates::0.5.50-preview
  2. Create a new application using the template: dotnet new blazorhybrid -o BlazorHybridPublishFailure
  3. Publish the BlazorHybridPublishFailure.Windows project using the Visual Studio publishing wizard, using ClickOnce as the deployment method
TheCakeMonster commented 3 years ago

For information, I've upgraded Visual Studio to Version 16.11.0 Preview 2.0, and the issue still occurs.

I've also manually installed SDK 5.0.204, which was previously missing from my machine. I think this is because I have, and I'm using 5.0.400-preview.21277.10 - which I think needed to be installed for Mobile Blazor Bindings to work, but exceeds the other runtime version numbers, so is perhaps overriding them.

The publish still fails. This may not be much of a surprise, as dotnet --info still reports 5.0.400-preview.21277.10

John-Hart commented 3 years ago

Sorry ClickOnce does not support Blazor templates. We should not be showing the ClickOnce publish provider for these projects.

Pilchie commented 3 years ago

@John-Hart these are new scenarios for hosting Blazor in a desktop app in .NET-6. ClickOnce support is a reasonable thing to expect.

John-Hart commented 3 years ago

@Pilchie thanks, we can look into adding it but right now it's not supported

TheCakeMonster commented 3 years ago

@John-Hart Thanks for the feedback; it's very useful to understand the issue and get a feeling for the issue.

Do you think the solution something that a community developer might have a reasonable chance of delivering? I'm a pro developer, but MSBuild is not something I feel is a particular strength - .props and .targets are something I am aware of, but are still a bit of a mystery.

I'd appreciate your input on whether this is something I can offer to deliver to the community, as it's something I wanted to use. If you think there's a reasonable chance that I can do the work, then let me know if there is someone who can give me some pointers.

John-Hart commented 3 years ago

@TheCakeMonster, appreciate the offer. We need some time to look into this. Right now I don't know what changes are required to support these projects.

TheCakeMonster commented 3 years ago

@John-Hart Understood, thanks.

sujitnayak commented 3 years ago

There are no current plans for ClickOnce to support Mobile Blazor Binding since it's not an officially released product.

Our current priority is to add ClickOnce publishing support to WPF/WinForms apps in the context of Blazor Desktop/WebView in the next Preview release of Visual Studio 2022.

Eilon commented 3 years ago

Indeed, I believe we recently fixed everything that's needed for this: https://github.com/dotnet/maui/pull/2187

The fix will be in the next preview of .NET 6.

TheCakeMonster commented 3 years ago

@Eilon thanks for the update, that's great news - and very good timing.

It appears that, suddenly, MBB no longer works on Windows. The deployment of the latest Edge Stable released Thursday 2nd/Friday 3rd Sept has broken it somehow. Anyone using it will need to move to .NET MAUI instead.

https://github.com/MicrosoftEdge/WebView2Feedback/issues/1714

Eilon commented 3 years ago

Oh yikes! I'll need to test this and see what's going on... maybe just updating to a newer WebView2 NuGet package might fix it somehow? I wonder if that works if you try it in your own project?