-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Along with .NET 8.0 Preview 1 we have release a preview of dotnet-mage tool: https://www.nuget.org/packages/Microsoft.DotNet.Mage/8.0.0-preview.1.23115.1
Notable changes are:
- Applications can discover the filename for activation using custom File Association
- Applications can discover arguments used for activation via appref-ms file
Note that this preview of dotnet-mage does not require .NET 8.0 Preview 1 and still runs on .NET 7.0. This will change in future preview releases.
Both changes were implemented with #245
Launcher will now read AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData array and set the appropriate environment variables if array is non-empty.
New environment variables
ClickOnce_ActivationData_Count
If this variable exists, the value is the count of elements in ActivationData string array.
ClickOnce_ActivationData_<n>
For each element in array, new environment variable gets added, with a zero-based index, i.e.:
ClickOnce_ActivationData_0
ClickOnce_ActivationData_1
...
Note that the scenarios being fixed always use the 0-index element, so the variable will always be ClickOnce_ActivationData_0, but the code is flexible and is able to pass all activation data to .NET app.
Usage scenario
Developer can read these environment variables to discover ActivationData content, using something like the following:
string value = Environment.GetEnvironmentVariable("ClickOnce_ActivationData_0");
Previously, for .NET FX apps, this would have been achieved using the following code:
string value = AppDomain.CurrentDomain?.SetupInformation?.ActivationArguments?.ActivationData?[0];