-
Notifications
You must be signed in to change notification settings - Fork 66
Allow apps to access ClickOnce deployment properties #208
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
Conversation
|
Great to see some love for click once... Is there a chance to tackle #113 (click once file associations)? Is it possible to hijack the |
Thanks @nzain - we plan to look at few other issues after this one is merged, one of those is the file-association issue you referred to. Current change for deployment properties and URL parameters was straightforward, well understood and prioritized. |
| { | ||
| ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; | ||
|
|
||
| Environment.SetEnvironmentVariable("ClickOnce_ActivationUri", ad.ActivationUri?.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these ToStrings appear unnecessary for string properties.
| Environment.SetEnvironmentVariable("ClickOnce_CurrentVersion", ad.CurrentVersion?.ToString()); | ||
| Environment.SetEnvironmentVariable("ClickOnce_DataDirectory", ad.DataDirectory?.ToString()); | ||
| Environment.SetEnvironmentVariable("ClickOnce_IsFirstRun", ad.IsFirstRun.ToString()); | ||
| Environment.SetEnvironmentVariable("ClickOnce_TimeOfLastUpdateCheck", ad.TimeOfLastUpdateCheck.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest using the round-trip format (O) rather than the default culture-specific format to preserve timezone and sub-seconds (assuming they are present).
|
What mage tool version was this released in? Currently we use version 6.0.1. |
|
How can I view the dotnet mage version? |
|
I find there is a difference between .NET 4.8 and .NET 6/7. If you have app
I didn't find any doc explain this difference, not sure if this is a bug or something by design. If it's by design, may I know any benefit of it? |
Created ApplicationDeployment.cs to reimplement some of the features from System.Deployment.Application that aren't available in .NET 7, as per: dotnet/deployment-tools#208
|
The old .NET Framework ClickOnce solution has a fully covered code example in the link: Would it be possible to get a equal covered code example in a .NET based solution? |
Fixes: #53
Launcher is being extended to share ClickOnce ApplicationDeployment properties with the application being launched (.NET based). Properties are shared via Environment variables.
Variable names closely match old ClickOnce ApplicationDeployment class: https://docs.microsoft.com/en-us/dotnet/api/system.deployment.application.applicationdeployment?view=netframework-4.8
New environment variables use the same name as old ones, with addition of
ClickOnce_prefix:New property is being added, for Launcher version:
.NET application, launched by new Launcher, can use these properties directly, or indirectly.
Direct use would look like the following:
Indirect usage would require implementation of a new ApplicationDeployment class, at application level, that could abstract reading of environment variables and provide experience that is very similar to old .NET FX class.
A sample implementation of this class is shared as
ApplicationDeployment.csin this PR (underDocumentation/dotnet-magefolder).With addition of this class, sample usage becomes:
This PR also adds a new switch to dotnet-mage,
-TrustURLParameters(or (-tu). This allows developer to set the required deployment attribute using dotnet-mage tool. This is an improvement over old Mage tool, which did not support this functionality and required developer to manually modify application manifest to add trustURLParameters attribute, like this:<deployment install="true" trustURLParameters="true">trustURLParametersneed to be set totruein order for application to have access to ActivationUri and the URL parameters.