Customizing Visual Studio MSIX packaging project output
Asked Answered
R

3

8

I'm using a Visual Studio MSIX packaging project to create an installer on a network share for an internal application.

One problem is that it's creating a directory with "_Test" at the end.

Why is it doing that and how do I get rid of it? I just want "MyApp.MSIX_0.0.1.0", or ideally, "MyApp.0.0.1.0".

 Directory of I:\

08/14/2020  09:44 AM    <DIR>          .
08/14/2020  09:44 AM    <DIR>          ..
08/14/2020  09:44 AM            21,312 index.html
08/14/2020  09:23 AM               601 MyApp.MSIX.appinstaller
08/14/2020  09:37 AM    <DIR>          MyApp.MSIX_0.0.1.0_Test
               2 File(s)         21,913 bytes
               3 Dir(s)  62,444,621,824 bytes free

I've been scouring the documentation, but I can't find anything about the directories it creates or the index.html file it generates. I'd like to customize all that, add release notes, etc.

This is a WPF app, if that makes any difference.

Rida answered 20/8, 2020 at 15:11 Comment(0)
L
10

I am just placing here a copy of the original answer from MSFT:

The output directory of the packages is defined in the Microsoft.AppxPackage.Targets file at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage (depending on your version of Visual Studio).

If you want to remove the "_Test" suffix you can modify the lines defining the output directory. In my file it was around line 3190 - 3196:

enter image description here

To modify the output html file, modify the index.template.html file in the "Landing" subdirectory - C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Landing (depending on VS version).

Littoral answered 2/9, 2020 at 7:44 Comment(3)
This works on a developer machine. How do I fix it when deploying from Azure DevOps?Omen
For Visual Studio 2022 Community the path is C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Microsoft\VisualStudio\v17.0\AppxPackageUndervest
GIven that this is hard-coded in this system-wide file, I am just going to use a script to rename these after they are packaged.Fording
O
7

If you are using Azure Pipelines to deploy, you can add parameters to the MSBuild task to do this. For example:

Hardcoded:

task: MSBuild@1
    displayName: MSBuild
    inputs:
      solution: '**/*.sln'
      platform: 'x64'
      configuration: 'Release'
      msbuildArguments: '/p:OutDir=$(Build.BinariesDirectory)/    
/p:AppxPackageTestDir="$(Build.BinariesDirectory)/MyApp.Installer/AppPackages/MyApp_1.0.0/"'

or using pipeline variables:

msbuildArguments: 
 /p:OutDir=$(Build.BinariesDirectory)/
/p:AppxPackageTestDir="$(Build.BinariesDirectory)/MyApp.Installer/AppPackages/$(packageName)_$(newVersion)/"

This gives a folder called "MyApp_1.0.0" instead of the confusing "MyApp_1.0.0_Test".

And the Uri property inside the .appinstaller file will correctly point to this folder.

Omen answered 23/6, 2021 at 13:27 Comment(1)
Very helpful! If you also want to edit the name of the file itself, you can use AppxPackageName. For example: dotnet publish <UNRELATED ARGUMENTS...> /p:AppxPackageTestDir="bin/Blah/net6.0-windows10.0.19041.0/win10-x64/AppPackages/MyApp_latest/" /p:AppxPackageName="MyApp_latest" (If it matters, I ran this with dotnet publish in Github Actions instead of msbuild/Azure Pipelines, as in the answer above)Hideandseek
L
0

For 2022 Professional, the file is: C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.AppxPackage.Targets

Licence answered 13/5, 2022 at 17:59 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.