Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Visual Studio 2022 Install - Cannot publish any .NET 7 MAUI Blazor app for Windows _GenerateAppxPackage #12625

Closed
shyftkenney opened this issue Jan 12, 2023 · 28 comments
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-info Issue needs more info from the author s/no-recent-activity Issue has had no recent activity t/bug Something isn't working

Comments

@shyftkenney
Copy link

Description

It's impossible to publish any .NET MAUI Blazor app including one straight from the project template. It simply does not work with the latest version of everything installed.

Severity Code Description Project File Line Suppression State
Error MSB4057 The target "_GenerateAppxPackage" does not exist in the project.

It seems completely broken. It has been reported but no response has been received yet after several days. Any patches or things to look at in the local environment would be great. The machine is a windows computer with the latest version of Windows 11 installed. It literally could not be more current.

Steps to Reproduce

  1. Create a new .NET MAUI BLAZOR project
  2. Build a release version
  3. Try to publish the app (sideload)

Link to public reproduction project repository

https://github.com/dotnet/maui

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

The only way to publish right now is to use the CLI

Relevant log output

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB4057	The target "_GenerateAppxPackage" does not exist in the project.
@shyftkenney shyftkenney added the t/bug Something isn't working label Jan 12, 2023
@TanayParikh TanayParikh added area-blazor Blazor Hybrid / Desktop, BlazorWebView area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) labels Jan 13, 2023
@javiercn
Copy link
Member

@shyftkenney thanks for contacting us.

Could you generate a binlog so that we can take a look? Or can you at least include the line and the file that is producing this error?

@javiercn javiercn added the s/needs-info Issue needs more info from the author label Jan 16, 2023
@ghost
Copy link

ghost commented Jan 16, 2023

Hi @shyftkenney. We have added the "s/needs-info" 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.

@shyftkenney
Copy link
Author

shyftkenney commented Jan 16, 2023 via email

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jan 16, 2023
@mattleibow
Copy link
Member

Did you follow these instructions? https://learn.microsoft.com/dotnet/maui/windows/deployment/publish-visual-studio-folder

I just did a test now with a brand new app and I was able to publish. Does it work with a File | New | Maui App template? What options did you select when publishing? Providing the logs from the Output window or even a full binlog (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis) will really help us see what you are doing differently to me.

@mattleibow mattleibow added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Jan 16, 2023
@ghost
Copy link

ghost commented Jan 16, 2023

Hi @shyftkenney. We have added the "s/needs-info" 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.

@symbiogenesis
Copy link
Contributor

symbiogenesis commented Jan 18, 2023

I am seeing this too, and have been for a month or so. I think it might have started with the .NET 7 service release.

CLI works.

I am also experiencing some issues doing a "dotnet workload update"

Warning: Workload garbage collection failed with error: An item with the same key has already been added. Key: (Microsoft.NETCore.App.Runtime.Mono.android-arm, 6.0.13).

It is possible that this oddity is unrelated.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jan 18, 2023
@shyftkenney
Copy link
Author

shyftkenney commented Jan 18, 2023 via email

@symbiogenesis
Copy link
Contributor

I ran another dotnet workload update after the latest service release and I'm able to publish now.

@shyftkenney
Copy link
Author

shyftkenney commented Jan 19, 2023 via email

@mkArtakMSFT mkArtakMSFT removed the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Jan 19, 2023
@AlexNek
Copy link

AlexNek commented Jan 20, 2023

I have exact the same problem. NET MAUI Blazor, target windows only, VS 17.4.4
I have different image for "Set the build target" as Publish a .NET MAUI app for Windows with Visual Studio
grafik

@shyftkenney
Copy link
Author

shyftkenney commented Jan 20, 2023 via email

@symbiogenesis
Copy link
Contributor

symbiogenesis commented Jan 20, 2023

I find that sometimes commenting out other target frameworks in the csproj, and then reloading the project, can help in general.

In addition to running "dotnet workload update, " I would check out the new update to the Single-Project MSIX extension for visual studio.

image

@AlexNek
Copy link

AlexNek commented Jan 20, 2023

I have Version: 1.2.0.2211083

@AlexNek
Copy link

AlexNek commented Jan 20, 2023

I actually gave up and just deployed this as a blazor web app instead.
I want to use "file save as" so it will be no so easy to switch.
Where is the time, when I can simple start the exe.

@symbiogenesis
Copy link
Contributor

I would also try to set the target framework to net7.0-windows10.0.22621.0 if possible. And I would restart visual studio after performing the workload update and extension update.

This particular bug seems solved to me, and needing to use "dotnet publish" via CLI wasn't so bad.

Publishing as an EXE is something that is under development, and I'm looking forward to this as well.

But windows store deployments with these new style msix bundles are pretty painless, and you can distribute to only a private audience if you want, and you get free auto-upgrade capability.

@symbiogenesis
Copy link
Contributor

Apparently you should already be able to publish as EXE if you aren't using one of the known incompatible features.

#8552

@AlexNek
Copy link

AlexNek commented Jan 20, 2023

I have now net7.0-windows10.0.19041.0
Why was net 7.0-maccatalist there?

@AlexNek
Copy link

AlexNek commented Jan 20, 2023

you aren't using one of the known incompatible features.
I think so but no success. In addition, I have DLL and error for that project - NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found... So CLI publish not possible too

@ThatGuyMike7
Copy link

Same problem here

@jsuarezruiz jsuarezruiz added s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Jan 30, 2023
@ghost
Copy link

ghost commented Jan 30, 2023

Hi @shyftkenney. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

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.

@AlexNek
Copy link

AlexNek commented Jan 30, 2023

That is very easy. Try to use default MAUI Blazor template and then Publish.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Jan 30, 2023
@mattleibow
Copy link
Member

When you say publish, is this in the IDE or the CLI? Can you send a screenshot of which menu item you select to publish if this is the IDE? I know there are a several publish options in the IDE so maybe one of the others are appearing.

@AlexNek
Copy link

AlexNek commented Jan 30, 2023

IDE of course /I use only one place on the solution explorer/. CLI is "not existing" for me. I use windows not *Nix.
With CLI it is working sometimes. (I have troubles with additional project)

@rmjoia
Copy link

rmjoia commented Jan 31, 2023

I can't publish using Visual Studio, works using the terminal...

Microsoft Visual Studio Enterprise 2022
Version 17.4.4
VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Enterprise

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.4.326.54890
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.4.326.54890
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.4.326.54890
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.4.1 (main@2ee106a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub Copilot   1.65.0.0 (v1.65.0.0@94a690b91)
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent   1.65.7705 (v1.65.0)

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.4.19 (8c0a575)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.40817.1 Commit Hash:66443775f9f3b1d8f8fee47af5002828b346688d
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62207.28050
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.10921.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools

Visual Studio Inline Suggestions   2.2.2361.27430
Ghost text API for Visual Studio inline suggestions

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.4.0.312 (d17-4@be7e8d1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.4.0.138 (remotes/origin/d17-4@d36bba3cc9)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   13.1.0.1 (d17-4/13ba222)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: a96bde9
    Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
    SQLite: xamarin/sqlite/3.39.3@23e1ae7
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a

getting the error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB4057	The target "_GenerateAppxPackage" does not exist in the project.	JewelsCafe	C:\....csproj	1	

Works fine on .Net 6.0... I'm using the same solution...

Steps to reproduce...

Switch your project if not already to .Net 7.0 (or to 6 to make it work, or test)
(in my case, I disabled all targets except Windows)
Build > Pack (or Publish)
image

@mattleibow
Copy link
Member

mattleibow commented Feb 4, 2023

I still can't reproduce this. I tried both a normal and a blazor maui app using the stable version of VS 17.4.4 using maui 7.0.52.

All works fine without an issue.

The only thing that I can think that can cause this issue if the Microsoft.WindowsAppSDK nuget got corrupted as that is where this target lives. Can you try clearing the nuget cache? Or deleting the C:\Users\<username>\.nuget\packages\microsoft.windowsappsdk folder.

The only way for me to diagnose any issues is with a sample project - even if it is the template because maybe your templates are corrupted - and with a binlog as that tells me what actually happened and what called what.

https://github.com/xamarin/xamarin-macios/wiki/Diagnosis

Many things will happen, but you should get a publish item somewhere:

image

Save that and attach it here. I will have a look and see what I can find... The missing target sounds like something is not getting included.

@mattleibow mattleibow added s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Feb 4, 2023
@dotnet dotnet deleted a comment Feb 4, 2023
@dotnet dotnet deleted a comment Feb 4, 2023
@AlexNek
Copy link

AlexNek commented Feb 4, 2023

Thanks for the answer. I try to replay all again and have curious behavior. Immediately after project creation I can deploy it.
Then I try to remove android and macos. After at in MS GUI I can see Deploy menu item but happens nothing.
MauiBlazorApp8.zip
2023-02-05_00-03-29
Why for only windows I have maccatalict target "TargetFrameworksnet7.0-maccatalyst /TargetFrameworks?" Sometimes I have message that it is impossible to debug that under windows. Sometimes I can start application with debug.
You can find my sample in attachment.
Thanks

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue labels Feb 4, 2023
@jsuarezruiz jsuarezruiz added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Feb 16, 2023
@ghost
Copy link

ghost commented Feb 16, 2023

Hi @shyftkenney. We have added the "s/needs-info" 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.

@ghost ghost added the s/no-recent-activity Issue has had no recent activity label Feb 20, 2023
@ghost
Copy link

ghost commented Feb 20, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@ghost ghost closed this as completed Feb 23, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-info Issue needs more info from the author s/no-recent-activity Issue has had no recent activity t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants