@@ -259,10 +259,23 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
259
259
if not ( assemblies.ContainsKey( referenceName)) then
260
260
try
261
261
if File.Exists( path) then
262
- // System.Private.CoreLib doesn't load with reflection
263
- if referenceName = " System.Private.CoreLib" then
262
+ match referenceName with
263
+ | " System.Runtime.WindowsRuntime"
264
+ | " System.Runtime.WindowsRuntime.UI.Xaml" ->
265
+ // The Windows compatibility pack included in the runtime contains a reference to
266
+ // System.Runtime.WindowsRuntime, but to properly use that type the runtime also needs a
267
+ // reference to the Windows.md meta-package, which isn't referenced by default. To avoid
268
+ // a bug where types from `Windows, Version=255.255.255.255` can't be found we're going to
269
+ // not default include this assembly. It can still be manually referenced if it's needed
270
+ // via the System.Runtime.WindowsRuntime NuGet package.
271
+ //
272
+ // In the future this branch can be removed because WinRT support is being removed from the
273
+ // .NET 5 SDK (https://github.com/dotnet/runtime/pull/36715)
274
+ ()
275
+ | " System.Private.CoreLib" ->
276
+ // System.Private.CoreLib doesn't load with reflection
264
277
assemblies.Add( referenceName, path)
265
- else
278
+ | _ ->
266
279
try
267
280
let asm = System.Reflection.Assembly.LoadFrom( path)
268
281
assemblies.Add( referenceName, path)
0 commit comments