Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Starting in the .NET 8.0 Preview 1 version of dotnet-mage, you can access ActivationData properties using environment variables. Using this version of dotnet-mage, you can programmatically:
- Discover the filename for activation based on a custom file association.
- Discover arguments used for activation in the appref-ms file.
The launcher reads the AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData array and sets the appropriate environment variables if the array is non-empty.
Environment variables
The following environments variables are set:
ClickOnce_ActivationData_CountIf this variable exists, the value is the count of elements in ActivationData string array.
ClickOnce_ActivationData_<n>For each element in array, a new environment variable gets added with a zero-based index, that is:
ClickOnce_ActivationData_0ClickOnce_ActivationData_1The scenarios fixed by this change always use the zero-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.
Access properties
You can read these environment variables to discover ActivationData content, using the following code:
string value = Environment.GetEnvironmentVariable("ClickOnce_ActivationData_0");
Previously, for .NET Framework apps, you would read this data using the following code:
string value = AppDomain.CurrentDomain?.SetupInformation?.ActivationArguments?.ActivationData?[0];