Skip to content
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

Xml and config transformation does not work on UWP #257

Open
soroshsabz opened this issue Jul 8, 2022 · 4 comments
Open

Xml and config transformation does not work on UWP #257

soroshsabz opened this issue Jul 8, 2022 · 4 comments

Comments

@soroshsabz
Copy link

ITNOA

transformation in UWP project dose not work when Application try to run with f5 in appx directory. it is just work in default output directory such as Debug or Release

@soroshsabz
Copy link
Author

soroshsabz commented Jul 10, 2022

I add some question for this in Stackoverflow

And I add some question for this in Microsoft Q&A

@soroshsabz
Copy link
Author

After many working I found solution, AppX Packaging is coordinate from Microsoft.AppxPackage.Targets that exists in Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\AppxPackage and all important target for packaging and running (f5 in Visual Studio) exists here.

As you can see in this file, Microsoft create some blank target between important target in build and packaging pipeline, so you can use override these blank targets very cleanly to control procedure of building and packaging AppX, for example you can override blow targets

      <!-- Override to specify actions to happen before generating project PRI file. -->
      <Target Name="BeforeGenerateProjectPriFile" />

or

      <!-- Override to specify actions to happen after generating project PRI file. -->
      <Target Name="AfterGenerateProjectPriFile" />

or ...

So for adding custom files into packaging I override BeforeGenerateProjectPriFile target and for adding file, I used PackagingOutputs ItemGroup for adding my file like below

  <Target Name="BeforeGenerateProjectPriFile">
    <ItemGroup>
      <PackagingOutputs Include="$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).exe.config">
        <OutputGroup>ContentFilesProjectOutputGroup</OutputGroup>
        <TargetPath>$(AssemblyName).exe.config</TargetPath>
        <ProjectName>$(ProjectName)</ProjectName>
      </PackagingOutputs>
    </ItemGroup>
  </Target>

If you want this approach in practice, I used this technique in linphone-windows10

@soroshsabz
Copy link
Author

soroshsabz commented Jul 13, 2022

I want to make PR for adding this systemically in slow-cheetah, after merging my previous PR #261.

@soroshsabz
Copy link
Author

@adrianvmsft Please assign this issue to me

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant