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

Fix not working with .NET Framework 4.7.2 #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -135,7 +137,11 @@ private Assembly Compile(IEnumerable<string> 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);
Expand Down
5 changes: 4 additions & 1 deletion source/VirtualDesktop/VirtualDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@
</None>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.5.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down