docs icon indicating copy to clipboard operation
docs copied to clipboard

Does not cover Microsoft.AspNet.Core.All

Open robertmclaws opened this issue 8 years ago • 33 comments

I'm getting the following error in my VS2017 projects: NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.All' specified a Version of 2.2.0-preview3-35497. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs. However, this document does not cover how Microsoft.AspNetCore.All should actually be referenced in this situation.

Also, the "Implicit References" section does not contain any code samples.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

robertmclaws avatar Oct 27 '18 16:10 robertmclaws

I'm getting the same for Microsoft.AspNetCore.App in a port I'm working on - currently specifying 2.1.5. I'm not sure what the goal of this error is...the result is definitely going to leave users confused in the current state.

cc @DamianEdwards

NickCraver avatar Nov 12 '18 00:11 NickCraver

@Rick-Anderson Is this something you know about?

Thraka avatar Nov 21 '18 17:11 Thraka

I'm getting the following error in my VS2017 projects: NETSDK1071: A PackageReference to Microsoft.AspNetCore.All

Use the versionless Microsoft.AspNetCore.App AKA M.A.App

I'm getting the same for Microsoft.AspNetCore.App in a port I'm working on

This document doesn't mention Microsoft.AspNetCore.All or Microsoft.AspNetCore.App

I'm getting the following error in my VS2017 projects: NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.All' specified a Version of 2.2.0-preview3-35497. Specifying the version of this package is not recommended

Correct, you should be using Microsoft.AspNetCore.App ( App, not All). I suspect the fwlink aka.ms/sdkimplicitrefs should be this link

I'm getting the same for Microsoft.AspNetCore.App in a port I'm working on - currently specifying 2.1.5.

M.A.App is versionless, don't specify a version.

Rick-Anderson avatar Nov 21 '18 19:11 Rick-Anderson

@Rick-Anderson Is there a way to not specify a version when using nuget? Nuget forces a version, right? I just upgraded to 2.2 and replaced Microsoft.AspNetCore.All with Microsoft.AspNetCore.App and am receiving this warning:

A PackageReference to 'Microsoft.AspNetCore.App' specified a Version of 2.2.0. Specifying the version of this package is not recommended.

perezdev avatar Dec 05 '18 15:12 perezdev

@perezdev https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app

Rick-Anderson avatar Dec 05 '18 19:12 Rick-Anderson

It wasn't immediately obvious to me what needed to happen after reading that article, so for the next person coming here with this warning... what I did was:

  1. unload the project
  2. edit the project file
  3. find the reference element
  4. remove the version attribute
  5. save and reload the project.

Then the warning went away. Not sure if there's an easier way.

aeslinger0 avatar Dec 10 '18 02:12 aeslinger0

@Rick-Anderson should I just update the link target then? I have permissions to do that.

mairaw avatar Dec 17 '18 22:12 mairaw

@mairaw yes

@aeslinger0 No need to unload the project before editing - otherwise your steps are correct.

Rick-Anderson avatar Dec 17 '18 22:12 Rick-Anderson

Not sure what you need, the doc is very clear

Recommendations

Since Microsoft.NETCore.App or NetStandard.Library metapackages are implicitly referenced, the following are our recommended best practices:

  • When targeting .NET Core or .NET Standard, never have an explicit reference to the Microsoft.NETCore.App or NetStandard.Library metapackages via a <PackageReference> item in your project file.

Maybe change that to:

  • When targeting .NET Core or .NET Standard, never have an explicit reference (that is, a version) ...

Rick-Anderson avatar Dec 17 '18 22:12 Rick-Anderson

I just had a quick call with @Rick-Anderson to discuss this. I think there are two issues here:

  • The target of the https://aka.ms/sdkimplicitrefs link doesn't cover the Microsoft.AspNetCore.All and Microsoft.AspNetCore.App scenarios when you get that error message and people don't know what to do
  • However, it seems that not specifying the version for those metapackages shouldn't reuse the link of the implicit reference case (https://aka.ms/sdkimplicitrefs) since those are not implicit package references. I think that error message should change in the product to use a new link.

As a stop gap, we can add some notes about the two packages in that section. And then link to a better place in the ASP.NET docs when that's available.

Thoughts?

/cc @danroth27 @DamianEdwards

mairaw avatar Dec 18 '18 19:12 mairaw

@livarcocc any suggestions on where this message is coming from so I can request the error message to be changed in this ASP.NET scenario?

mairaw avatar Dec 20 '18 23:12 mairaw

@dsplaisted This comes from the sdk itself.

livarcocc avatar Dec 21 '18 01:12 livarcocc

Specifically, the error message is defined here: https://github.com/dotnet/sdk/blob/master/src/Tasks/Common/Resources/Strings.resx

dsplaisted avatar Dec 21 '18 19:12 dsplaisted

Opened a new SDK issue then: https://github.com/dotnet/sdk/issues/2879

Moving the stop-gap solution for the current sprint.

mairaw avatar Jan 29 '19 00:01 mairaw

@mairaw , @Rick-Anderson How do you go about this in a Windows Console Project targeting .NET Core 2.2 and containing a self hosted web, those also needing to reference the nuget package 'Microsoft.AspNetCore.App'?

In the reply to @perezdev, @Rick-Anderson refers to https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app , but it's not really obvious what you are actually supposed to do.

In a completely new .Net core Console project (template: Visual C# ==> .NET Core ==> Console App (.NET Core) ), are you supposed to use the "Manage NuGet Packages..." feature you can access by right clicking the dependencies node in the Console project? And in the NuGet Package Manager add the 'Microsoft.AspNetCore.App' package? Should this get me a project that builds without warnings, or is this the wrong process to get a .NET Core Console project that can self-host the web server and which build without warnings?

Bartolomeus-649 avatar Apr 06 '19 06:04 Bartolomeus-649

@Bartolomeus-649 per the article I reference:

The Microsoft.AspNetCore.App metapackage isn't a traditional package that's updated from NuGet. Similar to Microsoft.NETCore.App, Microsoft.AspNetCore.App represents a shared runtime, which has special versioning semantics handled outside of NuGet. For more information, see Packages, metapackages and frameworks.

To update ASP.NET Core:

On development machines and build servers: Download and install the .NET Core SDK. On deployment servers: Download and install the .NET Core runtime.


You don't manage it from NuGet, you get it from the SDK.

Rick-Anderson avatar Apr 06 '19 17:04 Rick-Anderson

@Bartolomeus-649 ... and although we have similar coverage in the official docs, which no doubt you've seen, also check out @RickStrahl's blog post ... written in the 2.1-era, but I think all good. Where he says ".NET Core Windows Hosting Pack," we call that the "ASP.NET Core Hosting Bundle." Met Rick in person for the first time recently! It was a genuine honor to shake his hand and thank him in person for saving my keester a few times! :beers:

Keep in mind that what you need on the host also depends on the type of app you deploy:

If you end up hosting with IIS, install the "ASP.NET Core Hosting Bundle," a separate installer listed in the https://dot.net downloads for each release. Use the latest, but note that they had to pull the Preview 3 installer for 3.0 preview (use the Preview 2 installer if you're going to use 3.0 preview bits). There will be a Preview 4 Hosting Bundle when Preview 4 releases.

We have coverage on web hosting in:

guardrex avatar Apr 06 '19 19:04 guardrex

@Rick-Anderson Still don't get what I need to to do in Visual Studio to get a brand new .NET Core Console Application, created from the .NET Core Console template shipped with Visual Studio by Microsoft to build without warnings when you need to reference ASP.NET (libraries, namespaces, classes...).

Bartolomeus-649 avatar Apr 07 '19 13:04 Bartolomeus-649

@Bartolomeus-649 Did you confirm that your VS has the ASP.NET and web development workload installed. To confirm, run the VS installer, select Modify, and check the workloads that are checked off.

If you have that, could you put up a repro project on GH that I can pull down here and take a look at? ... something that you're getting errors with. I'll take a look and let you know if it repros here.

guardrex avatar Apr 07 '19 14:04 guardrex

Just create a new .NET Core Console project in Visual Studio by using the built-in/included template for -NET Core Console Applications, and then add the NuGet package Microsoft.AspNetCore.App and you'll get this warning when building: C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(153,5): warning NETSDK1071: A PackageReference to 'Microsoft.AspNetCore.App' specified a Version of 2.2.3. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs

Bartolomeus-649 avatar Apr 07 '19 15:04 Bartolomeus-649