public class Class1
{
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
What references should be added for these two interfaces please ? Or are you only supposed to only ever use these interfaces within the web site project ?
Also same result with a .NET Core 3.1 Class Library. Visual Studio 16.4.4
Any help much appreciated.
You might want to follow this guide (for migrating 2.2 to 3.0)
https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio
This explains what happened https://github.com/dotnet/AspNetCore/issues/7749
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- Should work with either if you have sdks installed and do restore -->
<!--<TargetFramework>netstandard2.1</TargetFramework>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.1" />
</ItemGroup>
</Project>
With class file
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;
namespace ClassLibrary2
{
public class Class1
{
public void Configure(IApplicationBuilder app, IHostEnvironment env)
{
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
With class file
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace ClassLibrary3
{
public class Class1
{
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With