Skip to content

Pin WindowsSdkPackageVersion #2613

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Pin WindowsSdkPackageVersion #2613

wants to merge 4 commits into from

Conversation

jfversluis
Copy link
Member

Description of Change

Also see #2612, but this one should be merged to main.

This change pins the WindowsSdkPackageVersion in the Directory.Build.props file to 10.0.19041.44. Additionally, it adds a note about keeping this in sync with .NET MAUI.

When we don't do that, depending on what is installed on the build agent or local machines or how the stars are aligned, we can get different versions of the WindowsAppSDK. That in turn might bring in different versions of transitive packages like WinRT.Runtime.

This was the case I was hitting. I tried to update the Toolkit dependency for the .NET MAUI templates, but it wouldn't build because the Toolkit was (transitively) referencing WinRT.Runtime 2.2.0 (because we were building against a newer WindowsAppSDK) and the templates were referencing WinRT.Runtime 2.1.0, because .NET MAUI pins the WindowsAppSDK to 10.0.19041.44 (at time of writing).

To overcome this happening by surprise lets pin the WindowsSdkPackageVersion in the Toolkit to the same version as .NET MAUI.

I'm doing this on a weirdish branch that is branched of the 11.1.0 tag and will be released as a 11.1.1 version. This is needed because 11.2.0 has a minimum dependency on .NET MAUI 9.0.50. The templates will be inserted in Visual Studio together with version 9.0.40, so I will need a version of the Toolkit with this bug fixed and that is able to be used with 9.0.40, hence this extra release.

This change also needs to be ported to the main branch so that we also do this moving forward.

@TheCodeTraveler TheCodeTraveler added needs discussion Discuss it on the next Monthly standup and removed needs discussion Discuss it on the next Monthly standup labels Apr 3, 2025
@crwsolutions
Copy link

Hi @jfversluis I saw you talking in the standup about this issue, just some minutes ago. I struggled with this. I am not really sure whether it is related. But when I had these two in my project:

<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>
<!--<WindowsPackageType>None</WindowsPackageType>-->

I get this error:

InnerException = {"Could not load file or assembly 'WinRT.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The system cannot find the file specified.":"WinRT.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709"}

And this is solved when I put this in my project:

<!--<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>-->
<WindowsPackageType>MSIX</WindowsPackageType>

launchSettings.json :
"commandName": "MsixPackage",

Hopefully this is somehow helpful 🙂

@jfversluis jfversluis marked this pull request as ready for review April 4, 2025 07:28
@Copilot Copilot AI review requested due to automatic review settings April 4, 2025 07:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • Directory.Build.props: Language not supported

@jfversluis
Copy link
Member Author

@crwsolutions thanks for watching and the suggestion! While in the same area I don't think its related... It might actually even be caused by the Toolkit...? We're building this from the library perspective and you are probably talking about a .NET MAUI app project. Our library doesn't have the concept of MSIX etc. but I'd be curious if we merge this, or maybe if you use the 11.1.1 version I just released if that changes this behavior. If you are willing and able to test that out I'm happy to hear the results!

@crwsolutions
Copy link

@jfversluis

but I'd be curious if we merge this, or maybe if you use the 11.1.1 version I just released if that changes this behavior

Yes, v11.1.1 also fixes it 👍

So about this line:

<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>

I think I added it in the past to resolve some problem, then I upgraded a lot (.net 9 etc), and moved it out to get it working. Can you recommend something? (This is a private project, I just want it to compile and work)

@jfversluis
Copy link
Member Author

You probably resolved the same problem only I'm resolving it in the Toolkit now.

I'm not sure what I need to recommend? What is the problem you still need help with? The fix I did for 11.1.1 will also go into 11.2.1 (or whatever version we will do next), so that will probably then fix it for you?

@crwsolutions
Copy link

I Checked my history: I think I added it because of this issue: CommunityToolkit/dotnet#923 . But I will leave it out then and hope for the best with a future upgrade.

@dotnet-policy-service dotnet-policy-service bot added stale The author has not responded in over 30 days help wanted This proposal has been approved and is ready to be implemented labels May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted This proposal has been approved and is ready to be implemented stale The author has not responded in over 30 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants