commit cda7a08e1480417cdb83f724829c1f5e4d663192
parent ea86a012c48f9e444098263857f809a0d3deb8d9
Author: Ruben Guerrero <rubengu@microsoft.com>
Date: Thu, 23 Mar 2023 11:44:58 -0700
Make ConfigurationRemotingServer selfcontained (#3097)
This PR removes the dependency on the .net6 runtime for ConfigurationRemotingServer by making it selfcontained. The downside is that now we carry it in the package, but oh well...
I had a long fight with PowerShell's contentFiles to pick the right modules, so what I ended up doing is to exclude contentFiles and add them manually as an AfterBuild task. We need the ref directory and the win modules in the same location as System.Management.Automation.dll
Diffstat:
7 files changed, 107 insertions(+), 26 deletions(-)
diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln
@@ -832,24 +832,24 @@ Global
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Debug|x64.Build.0 = Debug|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Debug|x86.ActiveCfg = Debug|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Debug|x86.Build.0 = Debug|Any CPU
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|ARM64.ActiveCfg = Debug|ARM64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|ARM64.Build.0 = Debug|ARM64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x64.ActiveCfg = Debug|x64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x64.Build.0 = Debug|x64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x86.ActiveCfg = Debug|x86
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x86.Build.0 = Debug|x86
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|ARM64.ActiveCfg = Release|ARM64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|ARM64.Build.0 = Release|ARM64
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|ARM64.ActiveCfg = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|ARM64.Build.0 = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x64.ActiveCfg = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x64.Build.0 = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x86.ActiveCfg = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Fuzzing|x86.Build.0 = Debug|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|ARM64.Build.0 = Release|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|x64.ActiveCfg = Release|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|x64.Build.0 = Release|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|x86.ActiveCfg = Release|Any CPU
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.Release|x86.Build.0 = Release|Any CPU
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|ARM64.ActiveCfg = Release|ARM64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|ARM64.Build.0 = Release|ARM64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x64.ActiveCfg = Release|x64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x64.Build.0 = Release|x64
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.ActiveCfg = Release|x86
- {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.Build.0 = Release|x86
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|ARM64.ActiveCfg = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|ARM64.Build.0 = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x64.ActiveCfg = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x64.Build.0 = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.ActiveCfg = Release|Any CPU
+ {71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.Build.0 = Release|Any CPU
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|ARM64.ActiveCfg = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|ARM64.Build.0 = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj b/src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj
@@ -97,6 +97,18 @@
copy "$(TargetDir)\resources.pri" "$(TargetDir)\AppInstallerCLI\resources.pri"
</PostBuildEvent>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='ARM'">
+ <ConfigServerRid>win10-arm</ConfigServerRid>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='ARM64'">
+ <ConfigServerRid>win10-arm64</ConfigServerRid>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='x64'">
+ <ConfigServerRid>win10-x64</ConfigServerRid>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='x86'">
+ <ConfigServerRid>win10-x86</ConfigServerRid>
+ </PropertyGroup>
<Target Name="WinGetIncludeAdditionalFilesInPackage" AfterTargets="_ComputeAppxPackagePayload">
<PropertyGroup>
<WinGetAdditonalPackageFileRoot>$(SolutionDir)</WinGetAdditonalPackageFileRoot>
@@ -123,7 +135,7 @@
<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\**\*">
+ <WinGetAdditionalPackageFile Include="$(WinGetAdditonalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\ConfigurationRemotingServer\net6.0-windows10.0.19041.0\$(ConfigServerRid)\**\*">
<PackagePath>ConfigurationRemotingServer</PackagePath>
<Recurse>true</Recurse>
</WinGetAdditionalPackageFile>
diff --git a/src/ConfigurationRemotingServer/ConfigurationRemotingServer.csproj b/src/ConfigurationRemotingServer/ConfigurationRemotingServer.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@@ -6,9 +6,26 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
- <Platforms>x64;x86;arm64</Platforms>
- <RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
+ <Platforms>x64;x86;arm;arm64</Platforms>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
+ <SelfContained>true</SelfContained>
+ <RuntimeIdentifiers>win10-x64;win10-x86;win10-arm;win10-arm64</RuntimeIdentifiers>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'x64' ">
+ <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
+ <RuntimeIdentifier>win10-x86</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'arm' ">
+ <RuntimeIdentifier>win10-arm</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'arm64' ">
+ <RuntimeIdentifier>win10-arm64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
@@ -16,9 +33,16 @@
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Microsoft.Management.Configuration.Processor\Microsoft.Management.Configuration.Processor.csproj">
- <PrivateAssets>build</PrivateAssets>
- </ProjectReference>
+ <ProjectReference Include="..\Microsoft.Management.Configuration.Processor\Microsoft.Management.Configuration.Processor.csproj" />
</ItemGroup>
+ <Target Name="PwshFiles" AfterTargets="AfterBuild" >
+ <ItemGroup>
+ <RefFiles Include="$(OutputPath)..\..\..\..\..\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\$(TargetFramework)\win\ref\**\*.*" />
+ <WinModuleFiles Include="$(OutputPath)..\..\..\..\..\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\$(TargetFramework)\win\Modules\**\*.*" />
+ </ItemGroup>
+ <Copy SourceFiles="@(RefFiles)" DestinationFolder="$(OutputPath)\ref\" />
+ <Copy SourceFiles="@(WinModuleFiles)" DestinationFolder="$(OutputPath)\Modules\%(RecursiveDir)\" />
+ </Target>
+
</Project>
\ No newline at end of file
diff --git a/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj b/src/Microsoft.Management.Configuration.Processor/Microsoft.Management.Configuration.Processor.csproj
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
+ <DotNetVersion>net6.0</DotNetVersion>
+ <TargetFramework>$(DotNetVersion)-windows10.0.19041.0</TargetFramework>
<Nullable>enable</Nullable>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<Platform>AnyCpu</Platform>
- <RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
+ <RuntimeIdentifier>win</RuntimeIdentifier>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
+ <!-- Workaround for MSB3271 error on processor architecture mismatch -->
+ <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
@@ -29,7 +32,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.1" />
- <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.8" />
+ <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.8" GeneratePathProperty="true">
+ <ExcludeAssets>contentFiles</ExcludeAssets>
+ </PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -57,4 +62,13 @@
</ItemGroup>
</Target>
+ <Target Name="PwshFiles" AfterTargets="AfterBuild" >
+ <ItemGroup>
+ <RefFiles Include="$(PkgMicrosoft_PowerShell_SDK)\contentFiles\any\any\ref\*.*" />
+ <WinModuleFiles Include="$(PkgMicrosoft_PowerShell_SDK)\contentFiles\any\any\runtimes\win\lib\$(DotNetVersion)\Modules\**\*.*" />
+ </ItemGroup>
+ <Copy SourceFiles="@(RefFiles)" DestinationFolder="$(OutputPath)\ref\" />
+ <Copy SourceFiles="@(WinModuleFiles)" DestinationFolder="$(OutputPath)\Modules\%(RecursiveDir)\" />
+ </Target>
+
</Project>
\ No newline at end of file
diff --git a/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj b/src/Microsoft.Management.Configuration.Projection/Microsoft.Management.Configuration.Projection.csproj
@@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<Platform>AnyCpu</Platform>
- <RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
diff --git a/src/Microsoft.Management.Configuration.UnitTests/Microsoft.Management.Configuration.UnitTests.csproj b/src/Microsoft.Management.Configuration.UnitTests/Microsoft.Management.Configuration.UnitTests.csproj
@@ -6,6 +6,7 @@
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<Platforms>x64;x86;arm64</Platforms>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
+ <RuntimeIdentifiers>win10-x64;win10-x86;win10-arm;win10-arm64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
@@ -34,6 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.18.2" />
+ <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.8" GeneratePathProperty="true"/>
</ItemGroup>
<ItemGroup>
@@ -47,9 +49,19 @@
</ProjectReference>
<ProjectReference Include="..\Microsoft.Management.Configuration.Processor\Microsoft.Management.Configuration.Processor.csproj">
<Private>True</Private>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ProjectReference>
</ItemGroup>
+ <Target Name="PwshFiles" AfterTargets="AfterBuild" >
+ <ItemGroup>
+ <RefFiles Include="$(OutputPath)..\..\..\..\..\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\$(TargetFramework)\win\ref\**\*.*" />
+ <WinModuleFiles Include="$(OutputPath)..\..\..\..\..\AnyCPU\$(Configuration)\Microsoft.Management.Configuration.Processor\$(TargetFramework)\win\Modules\**\*.*" />
+ </ItemGroup>
+ <Copy SourceFiles="@(RefFiles)" DestinationFolder="$(OutputPath)\ref\" />
+ <Copy SourceFiles="@(WinModuleFiles)" DestinationFolder="$(OutputPath)\Modules\%(RecursiveDir)%(Filename)%(Extension)" />
+ </Target>
+
<ItemGroup>
<None Update="TestCollateral\PowerShellModules\xSimpleTestResource\xSimpleTestResource.psd1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj
@@ -59,6 +59,26 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
+ <PropertyGroup Condition="'$(TargetFramework)' == '$(CoreFramework)'">
+ <RuntimeIdentifiers>win-x64;win-x86;win-arm;win-arm64</RuntimeIdentifiers>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'x64' AND '$(TargetFramework)' == '$(CoreFramework)'">
+ <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
+ <RuntimeIdentifier>win-x86</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'arm' ">
+ <RuntimeIdentifier>win-arm</RuntimeIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Platform)' == 'arm64' ">
+ <RuntimeIdentifier>win-arm64</RuntimeIdentifier>
+ </PropertyGroup>
+
<ItemGroup Condition="'$(TargetFramework)' == '$(CoreFramework)'">
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.6.5" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.8" />
@@ -98,7 +118,7 @@
<!-- Copy WinRTAct.dll to PowerShell module directory. Relative path to $(OutputPath) used to support AppInstaller build. -->
<Target Name="CopyWinRTAct" AfterTargets="AfterBuild" Condition="'$(Platform)' != 'ARM' AND '$(TargetFramework)' == '$(CoreFramework)'">
<PropertyGroup>
- <WinRTActDir>$(OutputPath)..\..\UndockedRegFreeWinRT\</WinRTActDir>
+ <WinRTActDir>$(OutputPath)..\..\..\UndockedRegFreeWinRT\</WinRTActDir>
</PropertyGroup>
<ItemGroup>
<WinRTActDll Include="$(WinRTActDir)winrtact.dll" />