microsoft / reverse-proxy

A toolkit for developing high-performance HTTP reverse proxy applications.
https://microsoft.github.io/reverse-proxy
MIT License
8.53k stars 838 forks source link

Build error: Package Microsoft.ReverseProxy 1.0.0-preview.1.20268.2 is not compatible with net50 #264

Closed brian2github closed 4 years ago

brian2github commented 4 years ago

Using Visual Studio Community 2019 version 16.6.2

Following instructions here: https://github.com/microsoft/reverse-proxy/blob/master/docs/docfx/articles/getting_started.md

ran 'dotnet new web -n MyProxy -f net5.0'

Opened up myproxy.csproj to verify that the targetframework was already set to net5.0

Added the ItemGroup/PackageReference.

Now my .csproj looks like:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
<ItemGroup>
 <PackageReference Include="Microsoft.ReverseProxy" Version="1.0.0-preview.1.*"
/>
</ItemGroup>
</Project>

Attempted to build in Visual Studio:

1>C:\WORKING\yarp-test\MyProxy\MyProxy.csproj : error NU1202: Package Microsoft.ReverseProxy 1.0.0-preview.1.20268.2 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.ReverseProxy 1.0.0-preview.1.20268.2 supports:
1>C:\WORKING\yarp-test\MyProxy\MyProxy.csproj : error NU1202:   - net5.0 (.NETCoreApp,Version=v5.0)
1>C:\WORKING\yarp-test\MyProxy\MyProxy.csproj : error NU1202:   - netcoreapp3.1 (.NETCoreApp,Version=v3.1)
brian2github commented 4 years ago

I think I might have found my own problem - I put the wrong command line for creating the project. I had to put 'netcoreapp'. But somehow it won't recognize 'netcoreapp5.0'... I am trying 'netcoreapp3.1' right now.

dotnet new web -n MyProxy2 -f netcoreapp3.1

Tratcher commented 4 years ago

What version of the SDK are you using? See dotnet --info. The templates changed from supporting netcoreapp5.0 to net5.0 for preview6, but that hasn't released yet.

brian2github commented 4 years ago

I had to use the 'netcoreapp3.1'. It appears to be working now. It was my initial mistake to put -f net5.0. Although I had installed multiple frameworks including .net preview 5.0, the 'dotnet new web' command didn't recognize that 5.0 was an option. Doesn't seem like a reverse-proxy issue, just a MS VS .net environment issue. Thanks for responding, I'm good for now.