-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Hi, in C# I’m trying to load a custom modified System.Private.CoreLib, I modified the Dictionary.cs generic class.
When I run my console application, I get:
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'. Failed to run as a self-contained app.
The application was run as a self-contained app because 'C:\Users\erikw\source\repos\MainDict2\MainDict2\bin\x64\Debug\net9.0\MainDict2.runtimeconfig.json' did not specify a framework.
If this should be a framework-dependent app, specify the appropriate framework in 'C:\Users\erikw\source\repos\MainDict2\MainDict2\bin\x64\Debug\net9.0\MainDict2.runtimeconfig.json'.
This is my main project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Extensions.DotNetDeltaApplier">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\sdk\9.0.302\DotnetTools\dotnet-watch\9.0.302-servicing.25319.7\tools\net9.0\any\hotreload\Microsoft.Extensions.DotNetDeltaApplier.dll</HintPath>
</Reference>
<Reference Include="System.Collections">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Collections.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Concurrent">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Collections.Concurrent.dll</HintPath>
</Reference>
<Reference Include="System.Console">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Console.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipes">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.IO.Pipes.dll</HintPath>
</Reference>
<Reference Include="System.Linq">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Private.CoreLib">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Private.CoreLib.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Runtime.InteropServices.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encoding.Extensions">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Text.Encoding.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Threading">
<HintPath>..\..\..\..\..\..\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.7\System.Threading.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Notice that I loaded all of the required assemblies to make the code compile… such as System.Runtime.dll
Note that I disabled the Implicit Framework References/Assemblies... I did so because I have a custom System.Private.CoreLib with a modified Dictionary.cs generic class. This is all for messing around with an example in my O'Reilly Programming C# 10.0 book. I am just playing around with the code in order to learn...
I tried to import hostpolicy.dll, but it gave me an error:
The reference is invalid or unsupported.
Any suggestions? Thanks!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status