Does not cover Microsoft.AspNet.Core.All
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.
- ID: cb4428fc-215c-78e1-5ff0-fe73f7a08260
- Version Independent ID: 6741b1de-38a4-fbb1-d79d-acc47d549a2d
- Content: Additions to the csproj format for .NET Core
- Content Source: docs/core/tools/csproj.md
- Product: dotnet-core
- GitHub Login: @blackdwarf
- Microsoft Alias: mairaw
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
@Rick-Anderson Is this something you know about?
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.Appin 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 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 https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app
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:
- unload the project
- edit the project file
- find the reference element
- remove the version attribute
- save and reload the project.
Then the warning went away. Not sure if there's an easier way.
@Rick-Anderson should I just update the link target then? I have permissions to do that.
@mairaw yes
@aeslinger0 No need to unload the project before editing - otherwise your steps are correct.
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.ApporNetStandard.Librarymetapackages 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) ...
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
@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?
@dsplaisted This comes from the sdk itself.
Specifically, the error message is defined here: https://github.com/dotnet/sdk/blob/master/src/Tasks/Common/Resources/Strings.resx
Opened a new SDK issue then: https://github.com/dotnet/sdk/issues/2879
Moving the stop-gap solution for the current sprint.
@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 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.
@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:
- Framework-dependent deployment/executable (FDD/FDE) apps require the .NET Core libs and runtime on the host. Always match the bitness of the runtime on the host to the bitness of your SDK on the dev machine to avoid problems.
- Self-contained deployment (SCD) apps carry the libs and runtime with it when you deploy it. You wouldn't need anything installed on the server for SCD self-host.
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:
@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 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.
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