Skip to content

CsWinRT nuget package should support enforcement of publicly available dependencies (winrt.runtime.dll) #845

@Scottj1s

Description

@Scottj1s

Recently, an update to CsWinRT required an increment to the AssemblyVersion of winrt.runtime.dll. Winrt.runtime.dll is distributed in the Microsoft.Windows.SDK.Net.Ref framework package, which is in turn integrated into the .NET SDK, which is in turn ingested into Visual Studio updates. Because of this, published updates to winrt.runtime.dll can significantly lag published updates of dependent CsWinRT projection assemblies such as Microsoft.WinUI.dll. This can result in build breaks due to assembly resolution.

Proposal: create an opt-in mode that enforces public availability of dependencies like winrt.runtime.dll. A project property like CsWinRTAssertAvailability would validate whether the AssemblyVersion of winrt.runtime.dll referenced by the locally configured .NET SDK is >= the AssemblyVersion of the CsWinRT nuget package's lib\net5.0\winrt.runtime.dll. If the comparison failed, the build would fail (cswinrt.exe would be prevented from executing).

The trail of breadcrumbs to establish the comparison:

  1. given the version of .NET SDK being used:

dotnet --version
5.0.203

  1. locate the corresponding .NET SDK root:

dotnet --list-sdks |findstr /c:"5.0.100 "
5.0.203 [C:\Program Files\dotnet\sdk]

  1. locate that .NET SDK's Microsoft.NETCoreSdk.BundledVersions.props file:
    C:\Program Files\dotnet\sdk\5.0.203\Microsoft.NETCoreSdk.BundledVersions.props
  2. scan the props file for the Microsoft.Windows.SDK.NET.Ref framework reference version:
    TargetingPackVersion="10.0.19041.15"
  3. locate the winrt.runtime.dll for that version of the nuget package:
    D:\NUGET_PACKAGES\microsoft.windows.sdk.net.ref\10.0.19041.15\lib\WinRT.Runtime.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions