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

Reference to Microsoft.AspNetCore.App not lead to an clear error when upgrade old projects to netcoreapp3.0 #4490

Closed
yyjdelete opened this issue Dec 7, 2018 · 2 comments
Labels
External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Duplicate Resolved as a duplicate of another issue

Comments

@yyjdelete
Copy link

yyjdelete commented Dec 7, 2018

Describe the bug

Reference to Microsoft.AspNetCore.App not lead to an clear error when upgrade old projects to netcoreapp3.0.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 'v3.0.0-preview-27122-01'
  2. Run this code 'dotnet new webapi'
  3. Modify the csproj, add an PackageReference or FrameworkReference to Microsoft.AspNetCore.App
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <!--<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>-->
  </PropertyGroup>


  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
    <!--<PackageReference Include="Microsoft.AspNetCore.App" />-->
  </ItemGroup>
</Project>
  1. With these arguments 'dotnet run'

  2. See error(case 1 and 2)

  3. When use PackageReference, with dotnet run in cmd failed, BUT INTERESTINGLY build&run successful in VS2019.

***.csproj : warning NU1604: 项目依赖项 Microsoft.AspNetCore.App 不具有包含下限。在依赖项版本中包含下限可确保一致的还原结果。
C:\Users\***\.nuget\packages\microsoft.aspnetcore.app\2.1.0\build\netcoreapp2.1\Microsoft.AspNetCore.App.targets(14,5): error : This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.App compatible with netcoreapp3.0. [***.csproj]

The build failed. Please fix the build errors and run again.
  1. When use FrameworkReference build successful but run failed with Invalid runtimeconfig.json.
    See there are duplicate items Microsoft.AspNetCore.App in frameworks
{
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "frameworks": [
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "3.0.0-preview-18579-0056"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "3.0.0-preview-18579-0056"
      }
    ],
    "configProperties": {
      "System.GC.Server": true
    }
  }
}
  1. I see aspnet/websdk#424, remove all reference to Microsoft.AspNetCore.App works. But most docs only say use FrameworkReference instead(like Breaking changes to Microsoft.AspNetCore.App in 3.0 aspnet/Announcements#325), and don't say people should remove it when upgrade.

Expected behavior

Run successful or get an error to say what's wrong clearly in case 2.
And the result in case 1 shouldn't be inconsistent between dotnet sdk(use directly in console) and VS2019.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

VS: 16.0.0 preview1
Add any other context about the problem here.

Include the output of dotnet --info

dotnet --info
.NET Core SDK(反映任何 global.json):
 Version:   3.0.100-preview-009812
 Commit:    e3abf6e935

运行时环境:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview-009812\

Host (useful for support):
  Version: 3.0.0-preview-27122-01
  Commit:  00c5c8bc40

.NET Core SDKs installed:
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.500-preview-009335 [C:\Program Files\dotnet\sdk]
  2.1.500-preview-009404 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009426 [C:\Program Files\dotnet\sdk]
  2.2.100-preview3-009430 [C:\Program Files\dotnet\sdk]
  2.2.100 [C:\Program Files\dotnet\sdk]
  2.2.200-preview-009648 [C:\Program Files\dotnet\sdk]
  3.0.100-preview-009812 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0-preview3-35497 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0-preview3-35497 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview-18579-0056 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0-preview3-27014-02 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview-27122-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-alpha-27128-4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
@natemcmaster natemcmaster added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Dec 7, 2018
@natemcmaster
Copy link
Contributor

Thanks for the feedback. It seems like there are actually several issues here.

  1. Versionless package reference in .NET Core 3.0 is a known issue https://github.com/dotnet/cli/issues/10124.
  2. Missing documentation for updating from 2.x to 3.0 - known issue, tracked by ASP.NET Core 2.2 to 3.0 migration AspNetCore.Docs#9490 (comment)
  3. Duplicate frameworks in runtimeconfig.json - this is new. @yyjdelete can you open a new issue on https://github.com/dotnet/sdk for this?

cc @DamianEdwards @dsplaisted @livarcocc

@natemcmaster natemcmaster added the feature-platform Deprecated: Cross-cutting issues related to ASP.NET Core as a platform label Dec 7, 2018
@natemcmaster
Copy link
Contributor

dotnet/sdk#2738 resolved part of this.

Closing in favor of dotnet/AspNetCore.Docs#9490 and dotnet/sdk#2735 which track the rest of the work to be done.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
@JunTaoLuo JunTaoLuo added External This is an issue in a component not contained in this repository. It is open for tracking purposes. and removed feature-platform Deprecated: Cross-cutting issues related to ASP.NET Core as a platform labels Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Duplicate Resolved as a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants