I have a WPF desktop bridge app and I use WindowsPowerShell to create a package to be published to the Microsoft Store. Recently I have run into a problem: if I change the version of Visual Studio in WindowsPowerShell script from 17th to 19th, the package will be created without the certificate which is defined in the .wapproj file(instead of using the valid one, a new certificate will be created and the package will be signed with it). This happens only when I use the 19th version of Visual Studio. I have looked through the logs of WindowsPowerShell, and there is no message saying that the certificate file had not been found.
Here is my powershell script:
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
set-alias msbuild $msbuild
#set folder atrtributes
Get-ChildItem $ENV:WORKSPACE -Recurse | foreach {$_.Attributes = 'Normal'}
$proj_name_centennial = "C:\Users\alexa\source\Workspaces\myApp\Sources\myApp\myApp.Package\myApp.Package.wapproj"
$solution_dir="C:\Users\alexa\source\Workspaces\myApp\Sources\myApp"
$vs_config = "Release"
$appx_packages_dir="AppxPackages\\"
$uap_appx_package_build_mode ="StoreUpload"
$appx_bundle="Never"
#RestoreNugetPackages
C:\Users\alexa\source\nuget.exe restore $proj_name
msbuild $proj_name_centennial /t:Build /p:Configuration=$vs_config /p:SolutionDir=$solution_dir/ /p:Platform=x64 /p:AppxPackageDir=$appx_packages_dir /p:UapAppxPackageBuildMode=$uap_appx_package_build_mode /p:AppxBundle=Never
What can be the reason of the certificate not being added to the package?