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

Add CsWinRT projection producing project for deployment API #4949

Merged
merged 7 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ AMap
Amd
amrutha
ansistring
Aot
APARTMENTTHREADED
apfn
apicontract
Expand Down
4 changes: 4 additions & 0 deletions src/AppInstallerCLIE2ETests/AppInstallerCLIE2ETests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<OutputType>Library</OutputType>
<DocumentationFile>$(OutDir)\AppInstallerCLIE2ETests.xml</DocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<SelfContained>true</SelfContained>
<RuntimeIdentifiers>win10-x64;win10-x86;win10-arm;win10-arm64</RuntimeIdentifiers>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Platform)' == 'x64' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<NoWarn>1591,8785</NoWarn>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<CsWinRTEnableLogging>true</CsWinRTEnableLogging>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<Platforms>x64;x86;arm64</Platforms>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
<RuntimeIdentifiers>win10-x64;win10-x86;win10-arm;win10-arm64</RuntimeIdentifiers>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IsAotCompatible>true</IsAotCompatible>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.54</WindowsSdkPackageVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<WindowsSdkPackageVersion>10.0.22000.54</WindowsSdkPackageVersion>
<WindowsSdkPackageVersion>10.0.22000.53</WindowsSdkPackageVersion>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why not the version that supports .NET 8 and UWP?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.53 also supports .NET 8. The UWP support is not exclusive to .54 (the phrasing in our release notes isn't entirely accurate). The .54 version just also has the projections for Windows.UI.Xaml.* types, but we're not using them here, so they're just not needed. Using .53 will still work just fine in UWP apps using .NET 9, don't worry 🙂

</PropertyGroup>

<PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the .targets in the NuGet package, we should add this:

<WindowsMetadataReference Include="<WINMD_PATH>" IsOutOfProcess="true" />

Where "<WINMD_PATH>" is the right path to the .winmd in the NuGet package.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<Platforms>x64;x86;arm64</Platforms>
<OutputType>Library</OutputType>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 12 additions & 1 deletion src/PowerShell/CommonFiles/WinGetAssemblyLoadContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// <copyright file="WinGetAssemblyLoadContext.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -81,6 +81,17 @@
return null;
}

/// <summary>
/// Handler to resolve unamanged assemblies.

Check failure on line 85 in src/PowerShell/CommonFiles/WinGetAssemblyLoadContext.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`unamanged` is not a recognized word. (unrecognized-spelling)
/// </summary>
/// <param name="assembly">Assembly initiating the unmanaged load.</param>
/// <param name="unmanagedDllName">Unmanaged dll name.</param>
/// <returns>The assembly ptr, zero if not in our assembly location.</returns>
internal static IntPtr ResolvingUnmanagedDllHandler(Assembly assembly, string unmanagedDllName)
{
return WinGetAcl.LoadUnmanagedDll(unmanagedDllName);
}

/// <inheritdoc/>
protected override Assembly Load(AssemblyName assemblyName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<DesktopFramework>net48</DesktopFramework>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<CsWinRTCcwLookupTableGeneratorEnabled>false</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<DesktopFramework>net48</DesktopFramework>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<CsWinRTCcwLookupTableGeneratorEnabled>false</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<RootNamespace>Microsoft.WinGet.Configuration</RootNamespace>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<CsWinRTCcwLookupTableGeneratorEnabled>false</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// <copyright file="ModuleInit.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -30,11 +30,13 @@ public void OnImport()
}

AssemblyLoadContext.Default.Resolving += WinGetAssemblyLoadContext.ResolvingHandler;
AssemblyLoadContext.Default.ResolvingUnmanagedDll += WinGetAssemblyLoadContext.ResolvingUnmanagedDllHandler;
}

/// <inheritdoc/>
public void OnRemove(PSModuleInfo module)
{
AssemblyLoadContext.Default.ResolvingUnmanagedDll -= WinGetAssemblyLoadContext.ResolvingUnmanagedDllHandler;
AssemblyLoadContext.Default.Resolving -= WinGetAssemblyLoadContext.ResolvingHandler;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<RuntimeIdentifier>win</RuntimeIdentifier>
<Configurations>Debug;Release;ReleaseStatic</Configurations>
<CsWinRTCcwLookupTableGeneratorEnabled>false</CsWinRTCcwLookupTableGeneratorEnabled>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.22000.52</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
2 changes: 1 addition & 1 deletion src/PowerShell/scripts/Initialize-LocalWinGetModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class WinGetModule
$this.Name = $n
$this.ModuleRoot = $m
$this.Output = Join-Path $o $this.Name
New-Item $this.Output -ItemType Directory -ErrorAction SilentlyContinue

if (Get-Module -Name $this.Name)
{
Expand All @@ -67,7 +68,6 @@ class WinGetModule
{
Write-Verbose "Copying binary files: $buildRoot\AnyCpu\$config\PowerShell\$($this.Name)\* -> $($this.Output)"
$copyErrors = $null
New-Item $this.Output -ItemType Directory -ErrorAction SilentlyContinue
Copy-Item "$buildRoot\AnyCpu\$config\PowerShell\$($this.Name)\*" $this.Output -Force -Recurse -ErrorVariable copyErrors -ErrorAction SilentlyContinue
$copyErrors | ForEach-Object { Write-Warning $_ }
}
Expand Down
Loading