diff --git a/source/VirtualDesktop/Interop/ComInterfaceAssemblyProvider.cs b/source/VirtualDesktop/Interop/ComInterfaceAssemblyProvider.cs index f0bf364..af5be6e 100644 --- a/source/VirtualDesktop/Interop/ComInterfaceAssemblyProvider.cs +++ b/source/VirtualDesktop/Interop/ComInterfaceAssemblyProvider.cs @@ -3,7 +3,9 @@ using System.IO; using System.Linq; using System.Reflection; +#if !NETFRAMEWORK using System.Runtime.Loader; +#endif using System.Text; using System.Text.RegularExpressions; using WindowsDesktop.Properties; @@ -22,7 +24,7 @@ internal class ComInterfaceAssemblyProvider private static readonly Version _requireVersion = new Version("1.0"); private readonly string _assemblyDirectoryPath; - + public ComInterfaceAssemblyProvider(string assemblyDirectoryPath) { this._assemblyDirectoryPath = assemblyDirectoryPath ?? _defaultAssemblyDirectoryPath; @@ -135,7 +137,11 @@ private Assembly Compile(IEnumerable sources) var result = compilation.Emit(path); if (result.Success) { +#if NETFRAMEWORK + return Assembly.LoadFrom(path); +#else return AssemblyLoadContext.Default.LoadFromAssemblyPath(path); +#endif } File.Delete(path); diff --git a/source/VirtualDesktop/VirtualDesktop.csproj b/source/VirtualDesktop/VirtualDesktop.csproj index bc0de6c..a33b0ae 100644 --- a/source/VirtualDesktop/VirtualDesktop.csproj +++ b/source/VirtualDesktop/VirtualDesktop.csproj @@ -52,9 +52,12 @@ + + + + -