-
Notifications
You must be signed in to change notification settings - Fork 52
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
Ability to set product name without changing assembly name #131
Comments
[Triage] @IGx89 are you aware if this issue reproes with old .NET FX tool Mage, or is it unique to dotnet-mage? @NikolaMilosavljevic please investigate. |
Thanks for investigating! Just checked, it reproes with the old .NET FX tool as well. |
You can fix this by editing the XML between generating the Deployment Manifest (.application file) and signing it. # Create the application manifest
dotnet mage `
-New Application `
-ToFile $appManifest `
-Name $applicationTitle `
-Version $version `
-FromDirectory $appFolder `
-IconFile $iconFile
# Sign the application manifest
dotnet mage `
-Sign $appManifest `
-CertFile $signingCert
# Create the deployment manifest (exename.application) file
dotnet mage `
-New Deployment `
-Install true `
-Name $clickOnceApplicationIdentity `
-Publisher $company `
-Version $version `
-AppManifest $appManifest `
-ToFile $deploymentManifest `
-ProviderURL $upgradeUrl `
-Processor $processor
# For some reason the MinVersion parameter only works on Update so update the .application file here
dotnet mage `
-Update $deploymentManifest `
-MinVersion $version `
-Publisher $company
# Certain properties are not generated by dotnet mage (or the older Mage.exe)
# but were generated by the old <GenerateDeploymentManifest> build task. Luckily
# they are just plain XML so we can add them in easily enough.
[xml]$xml = Get-Content $deploymentManifest
# Set up the namespaces
[System.Xml.XmlNamespaceManager] $nsm = New-Object System.Xml.XmlNamespaceManager $xml.NameTable
$asmv1 = 'urn:schemas-microsoft-com:asm.v1'
$asmv2 = 'urn:schemas-microsoft-com:asm.v2'
$cov1 = 'urn:schemas-microsoft-com:clickonce.v1'
$nsm.AddNamespace('asmv1', $asmv1)
$nsm.AddNamespace('asmv2', $asmv2)
$assemblyIdentity = $xml.SelectSingleNode('asmv1:assembly/asmv1:assemblyIdentity', $nsm)
$asmv1Description = $xml.SelectSingleNode('asmv1:assembly/asmv1:description', $nsm)
$asmv1Deployment = $xml.SelectSingleNode('asmv1:assembly/asmv2:deployment', $nsm)
# Update the XML attributes
$assemblyIdentity.SetAttribute('name', $clickOnceApplicationIdentity)
$asmv1Description.SetAttribute('publisher', $asmv2, $company)
$asmv1Description.SetAttribute('product', $asmv2, $applicationTitle)
# This tells ClickOnce that the files will all have the .deploy extension
$asmv1Deployment.SetAttribute('mapFileExtensions', 'true')
# Turns on the desktop shortcuts.
$asmv1Deployment.SetAttribute('createDesktopShortcut', $cov1, 'true')
# When saving, needs the absolute path
$xml.Save((Resolve-Path $deploymentManifest));
# Sign the deployment manifest
dotnet mage `
-Sign $deploymentManifest `
-CertFile $signingCert |
Hello! I was trying to use
dotnet-mage
to update the product name (assembly.description.name) of my application in the deployment manifest, but ran into a blocker: updating the product name also changes assemblyIdentity.name to the product name. They need to be different (product name is what's on the Start Menu, etc., while assembly name is a non-user-friendly assembly name), butdotnet-mage
appears to have no way to set them separately.The description of the
-Name
option says "The name that is used to identify the application. ClickOnce will use this name to identify the application in the Start menu (if the application is configured to install itself) and in Permission Elevation dialog boxes." That seems to imply it should update product name but not assembly name. My understanding of ClickOnce manifests is admittedly lacking so there could be a very good reason they're linked in your tool, though unfortunately in my situation they can't be the same (users would get an error upon startup due to the assembly identity name having changed).In the meantime I'm simply using
sed
to update the manifest and thendotnet-mage
to sign it, but it would be convenient to be able to do it all through the tool.The text was updated successfully, but these errors were encountered: