Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot publish .net6.0 wpf application

Tags:

c#

.net

I am trying to publish WPF app on .net6.0-windows platform that should be running on Win x64. App is buildable and is running on local, I can publish it in framework-dependant mode, but target PC does not have .Net6.0 so I need self-contained version.

I cannot create self-contained version. It always fails with generic pretty much useless message. enter image description here

Inside file there is just useless error.

System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. --- End of inner exception stack trace --- ---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.

===================

Only hint I have is build log:

1 of 10 projects are up-to-date for restore.
There was no runtime pack for Microsoft.WindowsDesktop.App.WPF available for the specified RuntimeIdentifier 'linux-x64'.
========== Build: 3 succeeded, 0 failed, 7 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

But I do not understand what is going on, I am trying to publish app under win x64, not linux.

enter image description here

App is using .net6.0-windows framework and multiple .net6.0 libraries.

like image 563
110mat110 Avatar asked Aug 22 '26 12:08

110mat110


1 Answers

Ensure you have the correct nuget source, as it tries to pull .net runtime compilers from a nuget source and not from your local machine in order to publish the self-contained solution: Nuget ORG Public URL: https://api.nuget.org/v3/index.json Add a nuget source: https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio

like image 125
Nimal Gajadhur Avatar answered Aug 25 '26 02:08

Nimal Gajadhur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!