Files
marticliment-WinGet-API-fro…/WindowsPackageManager Interop/WindowsPackageManager Interop.csproj
T
Martí Climent f6ca17b8bb Add code
2024-03-25 15:38:19 +01:00

68 lines
3.8 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<RootNamespace>DevHome.SetupFlow.Common</RootNamespace>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<Nullable>disable</Nullable>
</PropertyGroup>
<!--
CsWinRT properties:
https://github.com/microsoft/CsWinRT/blob/master/nuget/readme.md
-->
<PropertyGroup>
<CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata>
<CsWinRTIncludes>Microsoft.Management.Deployment</CsWinRTIncludes>
</PropertyGroup>
<ItemGroup>
<CsWinRTInputs Include="$(TargetDir)\Microsoft.Management.Deployment.winmd" />
<Content Include="$(TargetDir)\Microsoft.Management.Deployment.winmd" Link="Microsoft.Management.Deployment.winmd" CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(TargetDir)\Microsoft.Management.Configuration.dll" Link="Microsoft.Management.Configuration.dll" CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(TargetDir)\Microsoft.Management.Configuration.winmd" Link="Microsoft.Management.Configuration.winmd" CopyToOutputDirectory="PreserveNewest" />
<!-- This DLL from the winget COM interop package allows activating the winget server elevated -->
<Content Include="$(TargetDir)\winrtact.dll" Link="winrtact.dll" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<!--
Microsoft.WindowsPackageManager.ComInterop nuget targets .NET Framework:
https://www.nuget.org/packages/Microsoft.WindowsPackageManager.ComInterop#readme-body-tab
To workaround this issue in this .net project:
- Suppress warning 1701 (Package not compatible)
- Do not include nuget assets
- Generate a property for this package so the path can be referenced
- Copy the WINMD to the $(TargetDir) before the build starts
- Feed the $(TargetDir)\WINMD path to CsWinRT in order to generate the projected classes
NOTE: Suppressing the warning only is not enough as this will cause CoreClrInitFailure (0x80008089) error.
-->
<PackageReference Include="Microsoft.WindowsPackageManager.ComInterop" Version="1.7.10091-preview">
<NoWarn>NU1701</NoWarn>
<GeneratePathProperty>true</GeneratePathProperty>
<IncludeAssets>none</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.WindowsPackageManager.Configuration.OutOfProc" Version="1.7.10091-preview">
<GeneratePathProperty>True</GeneratePathProperty>
</PackageReference>
</ItemGroup>
<Target Name="CopyWinmdToTargetDir" BeforeTargets="BeforeBuild">
<Copy SourceFiles="$(PkgMicrosoft_WindowsPackageManager_ComInterop)\lib\Microsoft.Management.Deployment.winmd" DestinationFolder="$(TargetDir)" />
<Copy SourceFiles="$(PkgMicrosoft_WindowsPackageManager_ComInterop)\runtimes\win10-$(Platform)\native\winrtact.dll" DestinationFolder="$(TargetDir)" />
<Copy SourceFiles="$(PkgMicrosoft_WindowsPackageManager_Configuration_OutOfProc)\runtimes\win10-$(Platform)\native\Microsoft.Management.Configuration.dll" DestinationFolder="$(TargetDir)" />
<Copy SourceFiles="$(PkgMicrosoft_WindowsPackageManager_Configuration_OutOfProc)\runtimes\win10-$(Platform)\native\Microsoft.Management.Configuration.winmd" DestinationFolder="$(TargetDir)" />
</Target>
</Project>