Modify package identity in appx manifest after build - windows-runtime

Summary: Is it possible to modify app package identity after compilation using makeappx.exe?
I have a windows store app (for LOB sideloading, not for the store), which I need to create multiple copies (variants/instances) of, because I need to be able to install and run multiple versions of the app at the same time as a single user. Say my app is called MyMultiInstanceApp, I want to clone it into two apps called MyMultiInstanceApp-Prod and MyMultiInstanceApp-Test, because having these, I can install and run the *-Prod app in version 1.0 and the *-Test app in version 1.1 simultaneously.
I can achieve this by making multiple builds in Visual Studio and changing the package identity (name) in the manifest before each build - as described in Locally deploy parallel versions of a Windows Store App.
However, I would like to do it after build time, by making the copies based on the initial .appx package and I have it almost working using makeappx.exe and signtool.exe, but after installing e.g. MyMultiInstanceApp-Test, the app hangs on startup.
My approach is the following:
1) Create the initial .appx file by building solution in VS or through msbuild
2) Unpack the appx using:
makeappx.exe unpack /p MyMultiInstanceApp.appx /d unpacked
3) Modify the package identity in AppxManifest.xml to be:
<Identity Name="MyMultiInstanceApp-Test" Publisher="CN=JohnDoe" Version="1.1.0.0" ProcessorArchitecture="neutral" />
<Properties>
<DisplayName>MyMultiInstanceApp-Test</DisplayName>
...
4) Re-package the app using:
makeappx.exe pack /d unpacked /p MyMultiInstanceApp-Test.appx
5) Sign the package using the same certificate as used for the initial package using:
signtool.exe sign /a /v /fd SHA256 /f MyCert.pfx MyMultiInstanceApp-Test.appx
Installation of the new MultiInstanceApp-Test.appx seems successful, but when trying to start it - it just hangs and the following is visible in the Event Viewer under the entry:
\Applications and Services Logs\Microsoft\Windows\Apps\Microsoft-Windows-TWinUI/Operational:
[INFORMATION] Activation of app MyMultiInstanceApp-Test_pf28w44wh44hy!App attempted.
Execution state: Attempted activation of the app, 0, The operation
completed successfully.
[ERROR] Activation of the app MyMultiInstanceApp-Test_pf28w44wh44hy!App for
the Windows.Launch contract failed with error: The remote procedure
call failed.
Am I missing something or is modification of package identity not possible after compilation?

Related

Azure storage connection to Datalake G2 in SSIS using Access Key

Test connection Connection manger in SSIS to the azure storage using access key succeeded.
While copying data using Flexible file task in SSIS throwing an error "[Flexible File Task] Error: Could not load file or assembly 'Microsoft.Azure.Storage.Common, Version=11.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
The Folder paths and filenames everything seems correct.
What would be reason?
Azure.Storage.Common nuget package getting removed as soon as I close script task to run the package and throws same error
This is a spurious error message. It is a security error
Go to your storage account, under Settings, Configuration, change Minimum TLS version from 1.2 to 1.0.
Or if you want to keep the 1.2 channel, you will need to modify the registry on the computers that may run the SSIS package
To use TLS 1.2, add a REG_DWORD value named SchUseStrongCrypto with data 1 under the following two registry keys. HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft.NETFramework\v4.0.30319 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319
https://billfellows.blogspot.com/2022/01/ssis-azure-feature-pack-and-flexible.html
Furthermore, based on your comment referencing nuget. Nuget and SSIS Script Tasks and Components do not mix. The Developer experience of crafting a script knows how to use the nuget package manager to acquire the assemblies. However, when you close the script/component editor, those bits are not serialized with the project. When the package executes, there is no part of the run-time engine that identifies this assembly is from a nuget source and therefore, we need to download those bits. Instead, it fails when it cannot find the reference.
It still seems weird that a script task/component is throwing an exception about the azure bits as the Flexible File Task is not a script. https://learn.microsoft.com/en-us/sql/integration-services/control-flow/flexible-file-task?view=sql-server-ver15
Installing the correct Azure Feature Pack for Integration Services (SSIS) targeting the SQL server resolved my issue.

Sideloaded app requires package Microsoft.VCLibs.120.00 on my build server

In trying to run integration tests on my windows store app but the sideloading of my test appx file fails with error (0x80073CF3):
Windows cannot install package (my package GUID) because this package depends on another package that could not be found. This package requir
es minimum version 12.0.21005.1 of framework Microsoft.VCLibs.120.00 published by any publisher to install. Provide the framework along with this package..
The same procedure works fine on my dev machine (from powershell).
A Microsoft blog post states:
...In order to facilitate this scenario for sideloaded apps, we have made
the framework packages available here.
After downloading, and extracting the relevant architecture appx file, I installed it via powershell:
Add-AppxPackage "C:\temp\Microsoft.VCLibs.120.00_12.0.21005.1_x86__8wekyb3d8bbwe.appx"

Using Visual Studio Online to build Windows Store Apps?

I have a Windows Store Application (Windows 8.1), hosted on a GIT repo on Visual Studio Online.
I created a build definition, left all the default values as they were, ran the build and downloaded the artifacts.
I didn't find the Powershell script used to side load (install) the application, instead I found an .exe file.
What can be missing to generate the Powershell script needed to install the app?
The default build configuration is copying the files in "bin" folder to artifacts, that's why you see exe file.
To copy the package files to artifacts, please configure your build definition as following:
In "Visual Studio Build" step, add following argument in "MSBuild Arguments":
/p:AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\\"
And in "Publish Build Artifacts" steps, set "Path to Publish" as following:
$(Build.BinariesDirectory)\AppxPackages
To package Windows Store App during the TFS build process, you can (assume you're using XAML build):
1). Set MSBuild Arguments to be: /p:DeployOnBuild=true;DeployMethod=Package /p:DefaultPackageOutputDir="$(TF_BUILD_BINARIESDIRECTORY)"\StoreAppPackage
2). Set Output location to be 'SingleFolder' or 'PerProject'.
Then, after you queue one build, you will find one folder called StoreAppPackage in the TFS Build Drop folder. You can then find the Add-AppDevPackage.ps1 file.

Custom action fails to install MySQL

I have made a VS2010 project which installs MySQL by calling MySQLInstallerConsole.exe with necessary arguments. This works perfectly however, when I try to run this project's exe as a custom action it executes the exe but MySQL is not installed.
I checked the log file for MySQL exe and it had the following error:
Error 50: Package Name State change request failed.
What does this really mean, any solutions?
There are at least a couple of things that have something to do with this:
I believe the MySQL installer is an MSI file according to this:
http://dev.mysql.com/downloads/installer
You cannot install an MSI from a custom action of a Visual Studio setup because recursive calls to MSI installs are not allowed.
In a Everyone install custom actions run with the SYSTEM account, and installs are not often expecting this if they want to install files in user-profile folders because the SYSTEM account doesn't have any.
You need to bootstrap this somehow, and I think people are often using the WiX Burn bootstrapper for that. You define the ProductCode, name etc of the product and define how to install it.

SignTool Error: The specified algorithm cannot be used or is invalid

I am trying to use Visual Studio 2012 Express to sign my appx file for a windows store app, but get the following error:
SignTool Error: The specified algorithm cannot be used or is invalid
I am running the process through the STORE->Create App Packages menu, so I don't have direct access to the parameters for SignTool.
At first I thought it was because it was using a self-signed certificate from one of our other developers, so I changed to use our real certificate and still have the same problem.
Any ideas what could cause this and how to fix it?
EDIT: Suspected that the issue was that our normal certificate didn't support SHA-256, so I created a new test certificate in Visual Studio, but got the same result.
EDIT2: Verified that the hash algorithm in my appx package is SHA256, tried to run SignTool manually with the following command:
SignTool sign /a /f My_TemporaryKey.pfx /fd SHA256 /v /debug MyAppPackage.appx
Same error, no helpful information in the console messages.
I used older version of signtool.exe.
Update path in environment variable to older one.
Not working
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64"
Working
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64"
This happens when the certificate is not installed in the PC where you are trying to sign the application.
Install the .pfx file in the PC and then try to sign your application again.To install it, right click on the certificate and click on Install. Then follow the procedures to install it in your local computer.
In my case, after dozens of successfull executables files signatures using current company certificate on a legacy Windows XP development machine, I started getting the same error, which seems misleading.
To overcome it I had to change my usual timestamp server, which is a SignTool's optional parameter /t or /tr, as suggested by Daniel Georgiev. In this case, I chose http://timestamp.comodoca.com
The solution, since I usually import company's certificates into my Windows User Certificates Store (*) was as followed.
(*) After importing you certificate, there's no need to specify .pfx anymore during signing process.
Signtool.exe sign /t http://timestamp.comodoca.com /a /n "FileToBeSigned.exe" /v "MyExeFullPath"
In case, it still fails, I suggest you check this compreensive Alternative Timestamp Servers