Skip to content

Commit

Permalink
Make ConfigurationRemotingServer selfcontained (#3097)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
msftrubengu authored Mar 23, 2023
1 parent ea86a01 commit cda7a08
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 26 deletions.
28 changes: 14 additions & 14 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
36 changes: 30 additions & 6 deletions src/ConfigurationRemotingServer/ConfigurationRemotingServer.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<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>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.1" />
</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>
Original file line number Diff line number Diff line change
@@ -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'">
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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" />
Expand Down

0 comments on commit cda7a08

Please sign in to comment.