mansellan / clickonce

ClickOnce packager
Other
26 stars 7 forks source link

Support for net50 and 60 #49

Open BennyBread opened 2 years ago

BennyBread commented 2 years ago

Is there any chance to get support for net 5.0 and 6.0?

mansellan commented 2 years ago

Hi @BennyBread net5.0 and net6.0 are supported, at work I'm shipping a net6.0 WPF app right now. Unless you're talking about the installed dependencies list which I haven't updated for a while?

Are you seeing an error message?

BennyBread commented 2 years ago

Hi. It seems that this is not working for me. I was able to build an clickonce deployment for our dotnet net5.0-windows application. But thew installed program was not working because not all files were included/installed altough I didn't exclude anything.

What's also missing is an setup.exe for deployment (we'd like to use this for our deployment)

I think I will try to go the painful way using dotnet-mage...

mansellan commented 2 years ago

Ah ok, I see.

I'm compiling my net6.0 app as "self-contained", so all the dotnet dependencies come along for the ride. It sounds like you want the original, more lightweight "framework-dependent" deployment model, which assumes that the .Net assemblies are installed on the target machine (and creates a Setup.exe to ensure that).

That's definitely doable, but I can't comment on when I'll be able to get to it, sorry. I'll leave this issue open for now.

BennyBread commented 2 years ago

As it wasn't working for me I figured out that it is possible to use msbuild to create the clickonce setup:

This is the call I use: (Working directory must be set to the folder containing the .csproj -file!)

%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" && msbuild /t:publish /p:PublishProfile=Properties\PublishProfiles\ClickOnceProfile.pubxml /p:PublishDir=ClickOnce-build

SuperRich commented 2 years ago

Hi, The target framework only seems to go to 4.8. Does that matter? I'm also having issues with net5 however it is self contained so from what I gather should work. Only issue I can see is the target framework.

mansellan commented 2 years ago

Sorry, I need to update the UX here.

If you opt to use a launcher, it doesn't matter what version of .Net you use. The launcher is .Net 4.0, and just does a Process.Launch on your entry point. It could be .Net 6, or even a native app. Anything that can be started from a command line.

This is also how the .Net team got ClickOnce working with .Net Core. ClickOnce can only work with .Net Framework assemblies as the Windows team have no interest in updating the ClickOnce runtime for .Net Core,

This is moot though, because .Net has not used code access security since v2, so all assemblies since then effectively run under full trust, and hence can launch other processes. The VS2022 ClickOnce solution is open source under MIT, you can clone it here.

I'm hoping to write v2 of this utility soon, with a better UX, and more access to ClickOnce runtime features such as parameter injection. I just need to be careful not to disrupt existing v1 users, I'm still pretty new to DevOps extensions.