dotnet / deployment-tools

This repo contains the code to build the .NET deployment tools and installers for all supported platforms, as well as the sources to .NET deployment tools.
MIT License
172 stars 52 forks source link

dotnet-mage shows: Internal error ... 'Microsoft.Win32.Registry' threw an exception. #124

Open TheCollegedude opened 3 years ago

TheCollegedude commented 3 years ago

When I run dotnet-mage -update Application.application it shows:

Internal error, please try again. The type initializer for 'Microsoft.Win32.Registry' threw an exception.

Version 5.0.301 on Ubuntu 20.4 (x86_64)

TheCollegedude commented 3 years ago

The problem comes from calling Utilities.Misc.GetRegisteredOrganization, it does not work on Linux. This could just return an empty string when the OS is not Windows. A workaround is to append -Publish "X" as command line argument

NikolaMilosavljevic commented 3 years ago

[Triage] @TheCollegedude can you share some details about your end to end scenarios? ClickOnce application can only be installed on Windows as Linux does not have ClickOnce runtime components.

dotnet-mage is platform agnostic, but it was built from an old Windows-only tool Mage, to run on .NET 5. Some code might not work correctly on non-Windows platforms.

IGx89 commented 3 years ago

@NikolaMilosavljevic Just ran into this error myself and I can add a scenario: we're calling this in GitHub Actions where Linux build agents are half the cost of Windows ones, so we try to run as many workflows on Linux agents as possible.

If this does only support Windows, it would be good to call it out in the readme -- usually the assumption is that .NET Core apps are cross-platform unless otherwise noted.

NikolaMilosavljevic commented 3 years ago

@NikolaMilosavljevic Just ran into this error myself and I can add a scenario: we're calling this in GitHub Actions where Linux build agents are half the cost of Windows ones, so we try to run as many workflows on Linux agents as possible.

If this does only support Windows, it would be good to call it out in the readme -- usually the assumption is that .NET Core apps are cross-platform unless otherwise noted.

Agreed - we should document this.

NikolaMilosavljevic commented 3 years ago

The problem comes from calling Utilities.Misc.GetRegisteredOrganization, it does not work on Linux. This could just return an empty string when the OS is not Windows. A workaround is to append -Publish "X" as command line argument

A fix might be possible, for this particular scenario.

Some other known issues are signing, which is not supported on Linux, and wouldn't be easy to enable.

NikolaMilosavljevic commented 3 years ago

I've updated readme to clarify that dotnet-mage is fully supported on Windows. We are gathering feedback about scenarios for usage of the tool on Linux agents.

This and similar issues are very valuable for planning future work.

IGx89 commented 2 years ago

FYI, I haven't confirmed myself, but #171 appears to have fixed this issue in v6.0.1 (by way of #176).

pjmagee commented 5 months ago

And now im only finding this after hours.... Why would we not target windows only and even bother mentioning .NET5 + if its not built specifically to be Windows only. I thought mage was the xplat solution to not having to use msbuild clickonce which only worked with .net framework version of msbuild to do the installer stuff. And now i get so far to write some pipeline stuff which installs the tool on linux, since its not published to only work on Windows...

For now, I am running some commands on a windows machine in Github Job, and then taking artifacts from that to then pass onto linux agent for now, I think this is my compromise :)

pjmagee commented 5 months ago

I've updated readme to clarify that dotnet-mage is fully supported on Windows. We are gathering feedback about scenarios for usage of the tool on Linux agents.

This and similar issues are very valuable for planning future work.

This should have said mage is only windows supported, and dont even think about running it on linux containers or linux build agents. "Fully windows supported" wasnt clear for me. Nevermind.

pjmagee commented 5 months ago

When I run dotnet-mage -update Application.application it shows:

Internal error, please try again. The type initializer for 'Microsoft.Win32.Registry' threw an exception.

Version 5.0.301 on Ubuntu 20.4 (x86_64)

Did you end up finding another solution to doing OneClick deployment for Windows based .NET5+ WPF Apps? I've been struggling for hours since the documentation is scattered all over and there doesnt seem to be one good way of doing this other than having to use an IDE to manually deploy... which is not what I want to be doing. I want GitOps, builds and reelases via git tag events etc. :(