commit a47013a0b15b96ee34b491a695f4af3afe46bdc6
parent 0ec8c1bc6da650994e02b948b552f4c183d15140
Author: JohnMcPMS <johnmcp@microsoft.com>
Date: Thu, 16 Mar 2023 14:12:41 -0700
Rework extra packaged files mechanism (#3064)
This change is only to how we pull files into the package for development purposes. It better uses an `ItemGroup` and properties to enable the addition of files/directories by only adding one additional item, rather than 3 properties, 2 items, 1 message and 1 error.
Diffstat:
2 files changed, 44 insertions(+), 45 deletions(-)
diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln
@@ -7,6 +7,7 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "AppInstallerCLIPackage", "A
{1CC41A9A-AE66-459D-9210-1E572DD7BE69} = {1CC41A9A-AE66-459D-9210-1E572DD7BE69}
{2B00D362-AC92-41F3-A8D2-5B1599BDCA01} = {2B00D362-AC92-41F3-A8D2-5B1599BDCA01}
{5B6F90DF-FD19-4BAE-83D9-24DAD128E777} = {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}
+ {6597EB04-D105-49A7-A5A3-D27FE1DF895E} = {6597EB04-D105-49A7-A5A3-D27FE1DF895E}
{CA460806-5E41-4E97-9A3D-1D74B433B663} = {CA460806-5E41-4E97-9A3D-1D74B433B663}
EndProjectSection
EndProject
diff --git a/src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj b/src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj
@@ -88,7 +88,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AppInstallerCLI\AppInstallerCLI.vcxproj" />
- <ProjectReference Include="..\ConfigurationRemotingServer\ConfigurationRemotingServer.csproj" />
<ProjectReference Include="..\WinGetServer\WinGetServer.vcxproj" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
@@ -98,56 +97,55 @@
copy "$(TargetDir)\resources.pri" "$(TargetDir)\AppInstallerCLI\resources.pri"
</PostBuildEvent>
</PropertyGroup>
- <Target Name="IncludeWinMdInPackage" AfterTargets="_ComputeAppxPackagePayload">
+ <Target Name="WinGetIncludeAdditionalFilesInPackage" AfterTargets="_ComputeAppxPackagePayload">
<PropertyGroup>
- <WindowsPackageManagerPath>$(OutputPath)\..\WindowsPackageManager.dll</WindowsPackageManagerPath>
- <WindowsPackageManagerPath Condition="!Exists('$(WindowsPackageManagerPath)')">$(TargetDir)..\..\..\..\$(PlatformTarget)\$(Configuration)\WindowsPackageManager\WindowsPackageManager.dll</WindowsPackageManagerPath>
- <WindowsPackageManagerFileName>WindowsPackageManager.dll</WindowsPackageManagerFileName>
- <MicrosoftManagementDeploymentPath>$(OutputPath)\..\Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd</MicrosoftManagementDeploymentPath>
- <MicrosoftManagementDeploymentPath Condition="!Exists('$(MicrosoftManagementDeploymentPath)')">$(TargetDir)..\..\..\..\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd</MicrosoftManagementDeploymentPath>
- <MicrosoftManagementDeploymentFileName>Microsoft.Management.Deployment.winmd</MicrosoftManagementDeploymentFileName>
- <ConfigurationDllPath>$(OutputPath)\..\Microsoft.Management.Configuration.dll</ConfigurationDllPath>
- <ConfigurationDllPath Condition="!Exists('$(ConfigurationDllPath)')">$(TargetDir)..\..\..\..\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Configuration\Microsoft.Management.Configuration.dll</ConfigurationDllPath>
- <ConfigurationDllFileName>Microsoft.Management.Configuration.dll</ConfigurationDllFileName>
- <MicrosoftManagementConfigurationPath>$(OutputPath)\..\Microsoft.Management.Configuration\Microsoft.Management.Configuration.winmd</MicrosoftManagementConfigurationPath>
- <MicrosoftManagementConfigurationPath Condition="!Exists('$(MicrosoftManagementConfigurationPath)')">$(TargetDir)..\..\..\..\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Configuration\Microsoft.Management.Configuration.winmd</MicrosoftManagementConfigurationPath>
- <MicrosoftManagementConfigurationFileName>Microsoft.Management.Configuration.winmd</MicrosoftManagementConfigurationFileName>
- <MicrosoftManagementConfigurationProcessorPath>$(OutputPath)\..\..\AnyCPU\Microsoft.Management.Configuration.Processor\net6.0-windows10.0.19041.0\Microsoft.Management.Configuration.Processor.winmd</MicrosoftManagementConfigurationProcessorPath>
- <MicrosoftManagementConfigurationProcessorPath Condition="!Exists('$(MicrosoftManagementConfigurationProcessorPath)')">$(TargetDir)..\..\..\..\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\net6.0-windows10.0.19041.0\Microsoft.Management.Configuration.Processor.winmd</MicrosoftManagementConfigurationProcessorPath>
- <MicrosoftManagementConfigurationProcessorFileName>Microsoft.Management.Configuration.Processor.winmd</MicrosoftManagementConfigurationProcessorFileName>
+ <WinGetAdditonalPackageFileRoot>$(SolutionDir)</WinGetAdditonalPackageFileRoot>
+ <WinGetAdditonalPackageFileRoot Condition="!Exists('$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\WindowsPackageManager\WindowsPackageManager.dll')">$(OutputPath)\..\..\..\..</WinGetAdditonalPackageFileRoot>
</PropertyGroup>
+
+ <Message Importance="normal" Text="WinGetAdditonalPackageFileRoot = $(WinGetAdditonalPackageFileRoot)" />
<ItemGroup>
- <WindowsPackageManagerItem Include="$(WindowsPackageManagerPath)" />
- <MicrosoftManagementDeploymentWinmd Include="$(MicrosoftManagementDeploymentPath)" />
- <ConfigurationDllItem Include="$(ConfigurationDllPath)" />
- <MicrosoftManagementConfigurationWinmd Include="$(MicrosoftManagementConfigurationPath)" />
- <MicrosoftManagementConfigurationProcessorWinmd Include="$(MicrosoftManagementConfigurationProcessorPath)" />
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\WindowsPackageManager\WindowsPackageManager.dll">
+ <PackagePath>WindowsPackageManager.dll</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Deployment\Microsoft.Management.Deployment.winmd">
+ <PackagePath>Microsoft.Management.Deployment.winmd</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Configuration\Microsoft.Management.Configuration.dll">
+ <PackagePath>Microsoft.Management.Configuration.dll</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Configuration\Microsoft.Management.Configuration.winmd">
+ <PackagePath>Microsoft.Management.Configuration.winmd</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\**\Microsoft.Management.Configuration.Processor.winmd">
+ <PackagePath>Microsoft.Management.Configuration.Processor.winmd</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Projection\**\Microsoft.Management.Configuration.Projection.dll">
+ <PackagePath>ConfigurationRemotingServer\Microsoft.Management.Configuration.Projection.dll</PackagePath>
+ </WinGetAdditionalPackageFile>
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\ConfigurationRemotingServer\net6.0-windows10.0.19041.0\**\*">
+ <PackagePath>ConfigurationRemotingServer</PackagePath>
+ <Recurse>true</Recurse>
+ </WinGetAdditionalPackageFile>
</ItemGroup>
- <Error Condition="!Exists('$(WindowsPackageManagerPath)')" Text="$(WindowsPackageManagerPath) was not found" />
- <Error Condition="!Exists('$(MicrosoftManagementDeploymentPath)')" Text="$(MicrosoftManagementDeploymentPath) was not found" />
- <Error Condition="!Exists('$(ConfigurationDllPath)')" Text="$(ConfigurationDllPath) was not found" />
- <Error Condition="!Exists('$(MicrosoftManagementConfigurationPath)')" Text="$(MicrosoftManagementConfigurationPath) was not found" />
- <Error Condition="!Exists('$(MicrosoftManagementConfigurationProcessorPath)')" Text="$(MicrosoftManagementConfigurationProcessorPath) was not found" />
- <Message Importance="normal" Condition="Exists('$(WindowsPackageManagerPath)')" Text="$(WindowsPackageManagerPath) -> $(WindowsPackageManagerFileName)" />
- <Message Importance="normal" Condition="Exists('$(MicrosoftManagementDeploymentPath)')" Text="$(MicrosoftManagementDeploymentPath) -> $(MicrosoftManagementDeploymentFileName)" />
- <Message Importance="normal" Condition="Exists('$(ConfigurationDllPath)')" Text="$(ConfigurationDllPath) -> $(ConfigurationDllFileName)" />
- <Message Importance="normal" Condition="Exists('$(MicrosoftManagementConfigurationPath)')" Text="$(MicrosoftManagementConfigurationPath) -> $(MicrosoftManagementConfigurationFileName)" />
- <Message Importance="normal" Condition="Exists('$(MicrosoftManagementConfigurationProcessorPath)')" Text="$(MicrosoftManagementConfigurationProcessorPath) -> $(MicrosoftManagementConfigurationProcessorFileName)" />
+
+ <Error Condition="!Exists('%(WinGetAdditionalPackageFile.Identity)')" Text="%(WinGetAdditionalPackageFile.Identity) was not found" />
+
+ <!-- Single (non-recursive) file items -->
+ <Message Importance="normal" Condition="'%(WinGetAdditionalPackageFile.Recurse)'!='true' AND Exists('%(WinGetAdditionalPackageFile.Identity)')" Text="%(WinGetAdditionalPackageFile.Identity) -> %(WinGetAdditionalPackageFile.PackagePath)" />
+
<ItemGroup>
- <AppxPackagePayload Include="@(WindowsPackageManagerItem)" KeepDuplicates="false">
- <TargetPath>$(WindowsPackageManagerFileName)</TargetPath>
+ <AppxPackagePayload Condition="'%(WinGetAdditionalPackageFile.Recurse)'!='true'" Include="%(WinGetAdditionalPackageFile.Identity)" KeepDuplicates="false">
+ <TargetPath>%(WinGetAdditionalPackageFile.PackagePath)</TargetPath>
</AppxPackagePayload>
- <AppxPackagePayload Include="@(MicrosoftManagementDeploymentWinmd)" KeepDuplicates="false">
- <TargetPath>$(MicrosoftManagementDeploymentFileName)</TargetPath>
- </AppxPackagePayload>
- <AppxPackagePayload Include="@(ConfigurationDllItem)" KeepDuplicates="false">
- <TargetPath>$(ConfigurationDllFileName)</TargetPath>
- </AppxPackagePayload>
- <AppxPackagePayload Include="@(MicrosoftManagementConfigurationWinmd)" KeepDuplicates="false">
- <TargetPath>$(MicrosoftManagementConfigurationFileName)</TargetPath>
- </AppxPackagePayload>
- <AppxPackagePayload Include="@(MicrosoftManagementConfigurationProcessorWinmd)" KeepDuplicates="false">
- <TargetPath>$(MicrosoftManagementConfigurationProcessorFileName)</TargetPath>
+ </ItemGroup>
+
+ <!-- Recursive file items -->
+ <Message Importance="normal" Condition="'%(WinGetAdditionalPackageFile.Recurse)'=='true' AND Exists('%(WinGetAdditionalPackageFile.Identity)')" Text="%(WinGetAdditionalPackageFile.Identity) -> %(WinGetAdditionalPackageFile.PackagePath)\%(WinGetAdditionalPackageFile.RecursiveDir)%(WinGetAdditionalPackageFile.Filename)%(WinGetAdditionalPackageFile.Extension)" />
+
+ <ItemGroup>
+ <AppxPackagePayload Condition="'%(WinGetAdditionalPackageFile.Recurse)'=='true'" Include="%(WinGetAdditionalPackageFile.Identity)" KeepDuplicates="false">
+ <TargetPath>%(WinGetAdditionalPackageFile.PackagePath)\%(WinGetAdditionalPackageFile.RecursiveDir)%(WinGetAdditionalPackageFile.Filename)%(WinGetAdditionalPackageFile.Extension)</TargetPath>
</AppxPackagePayload>
</ItemGroup>
</Target>