samples
samples copied to clipboard
HostWithHostFxr is missing NET Framework Reference
Issue description
Attempting to build the sample with Visual Studio 2019 at samples/core/hosting/HostWithHostFxr/ will produce the following error:
Your project does not reference ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
I'm not quite sure how to resolve this as there does not seem to be such an option under the NativeHost.vs project.
Target framework
- [x] .NET Core 3.1? (I believe the sample is for 3.1 but I do have 5.0 installed, is there a cause?)
- [ ] .NET Framework
- [ ] .NET Standard
dotnet --info output or About VS info
.NET SDK (reflecting any global.json):
Version: 5.0.200
Commit: 70b3e65d53
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.200\
Host (useful for support):
Version: 5.0.3
Commit: c636bbdc8a
.NET SDKs installed:
5.0.200 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
For anyone else who is trying to do the same but encountering the same issue, I have hacked together a sample here that works: https://github.com/Pycorax/.NET-Core-HostWithHostFxr-Sample
I'm not too sure if this is the proper way to do it since I am new to this too but it works at least. Would love if someone could shed light on what I've done incorrectly if any!