-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
Discussion for the Microsoft.AspNetCore.App implicit version #6430
Comments
I've changed the PackageReferences in my projects from Microsoft.AspNetCore.All to Microsoft.AspNetCore.App (without version number) as was suggested by the ASP.NET Core 2.0 to 2.1 migration guide. After that I got a bunch of build warnings like this: Warning NU1604: Project dependency Microsoft.AspNetCore.App does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. Warning NU1602: [Project Name] does not provide an inclusive lower bound for dependency Microsoft.AspNetCore.App. An approximate best match of Microsoft.AspNetCore.App 2.1.0 was resolved. The Microsoft.AspNetCore.App description here contains the following phrase: "The Microsoft.AspNetCore.App metapackage is not a traditional package that is updated from NuGet." If it's not a normal NuGet package, I would expect that I should not be getting NuGet warnings for it. Getting build warnings when everything is actually fine is annoying and creates a risk that after some time I'll stop paying attention to build warnings at all and miss some "genuine" warning. I don't think NU1602 and NU1604 should be suppressed at the project level, as these warnings make sense for "normal" NuGet packages. I tried to disable these warnings for the PackageReferences for Microsoft.AspNetCore.App using the instructions from here: <PackageReference Include="Microsoft.AspNetCore.App">
<NoWarn>NU1602,NU1604</NoWarn>
</PackageReference> I got fewer build warnings, but some projects still reported them. These projects themselves did not contain PackageReferences for Microsoft.AspNetCore.App, but they referenced other projects that did. To suppress warnings for these projects, I had to add PackageReferences for Microsoft.AspNetCore.App to their .csproj files. Then I was able to build the solution without warnings. If it's relevant - I'm using Visual Studio 2017 Community Edition, version 15.7.3 My question is - is there a simpler way to suppress build warnings for Microsoft.AspNetCore.App package? It would be also good to update documentation for this metapackage and include an instruction of how to suppress them. |
@JunTaoLuo please comment. |
The warnings you are getting suggests that you are using the 2.0 SDK which doesn't contain the logic that sets the implicit versions for Microsoft.AspNetCore.App. Do you have the latest 2.1 SDK (2.1.300) installed? See: https://www.microsoft.com/net/download/ |
Hello @JunTaoLuo, I have it installed on my workstation: I also have a lot of older SDKs installed, so that might be causing the problem... |
Hmm then I'm curious why it's not working. What does |
Here's the output of
|
Hmm I'm unable to reproduce the issue locally, but I also don't have many older SDKs installed so that may be the problem. Are you able to reproduce the issue on the command line with |
@JunTaoLuo, thank you for taking the time to look into that. Yes, I'm getting the same warnings when running |
For me following change in csproj project file helped: My case was a class library project that was converted from 2.0 to 2.1 and had a following reference: Using Visual Studio 15.7.3 and 2.1.300 SDK. |
Sorry for the slow response, but as @ToTameALand mentioned the problem here is that the SDK must be set to |
@JunTaoLuo, @ToTameALand, thank you for looking into this! You are right, all projects in my solution that produced the NuGet build warnings indeed use I've removed the references to Microsoft.AspNetCore.App from my class libraries, actual ASP.NET Core projects still reference Microsoft.AspNetCore.App. I don't get any warnings when building my solution now. As regards https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.1, a warning like "Do not add a reference to Microsoft.AspNetCore.App to your class library, it won't work properly" could be included there, so that another developer wouldn't make the same mistake that I did. |
Same issue here, the comment #6430 (comment) |
When I install current SDK (2.1.301) and publish default web applicatation to azure with implicit version, I get: HTTP Error 502.5 - Process FailureApp Service Development Console in Azure Portal:
If it is recommended to use implicit version, then WTF? |
It looks like azure doesn't have the 2.1.301 SDK or the 2.1.1 runtime installed yet. @davidebbo do you know when the new bits will be available? |
Previous comment was 3 days ago, and deployment completed Friday morning PST. My guess is that at the time @Liero tried it wasn't there yet, but got there shortly after. Please try again. |
@JunTaoLuo: my point is, that following recommended practices results in very poor developer experience. Do you think that application startup failure caused just by installing latest SDK locally that differs only in patch version is predictable and expected behavior? If no, then do something about it. |
@Liero In general we don't expect to increment the implicit version of the Microsoft.AspNetCore.App metapackage during patches, as described in the documentation: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.1. However, during this release, we realized there were some issues with our version ranges that could lead to more warnings and errors in future patches so we needed to modify the metapackage and increment the implicit version used by apps targeting |
A key issue here is that if we compile with warnings as errors (as we do) this will break the build, unless we explicitly add NoWarn for these errors. I think it is problematic to force a NoWarn whenever this dependency is referenced for customers that want to treat warnings as errors. |
@iancooper what kind of warnings are you seeing? The reason we updated the base implicit version this release was to avoid such warnings so I'd be interested to see why it didn't work for you. |
I am using Razor pages and seeing this warning. How do I fix the issue? Here is my .csproj file:
|
@mrlife |
The implicit version gave me build errors in VSTS, although I am using SDK 2.1.301 there (as I do locally). I reference the Microsoft.Net.Sdk.Web and updated the other necessary NuGets for my project to 2.1.1 but in VSTS the build fails with NU1107 (version conflict), see dotnet/aspnetcore#3250 |
After reviewing customer feedback and lots of design discussion, we think the implicit package version has created more confusion than help. We are planning to change course and go back to recommending using the Version attribute on the PackageReference to Microsoft.AspNetCore.App/All. |
@JunTaoLuo I was able to repro! https://github.com/VictorioBerra/aspnet-Docs-issues-6430 Essentially I created new apps with Now when I open the solution I get the same error: If you could let me know the solution i would really appreciate it. VersionsVisual Studio Enterprise 15.8.2
|
I was able to build the Sample test project by applying the fix I mentioned in the comment above: VictorioBerra/aspnet-Docs-issues-6430#1. Let me know if this works for you. |
Replying here to keep the discussion in one place: @JunTaoLuo this seems to work just fine. Although I really do dislike the idea of having to target a web Sdk via a test project. What will be the approach in 2.2 or 2.3? I assume this is not a permanent workaround? |
@natemcmaster has more up to date information on this but I think it's the same for 2.2. However for the release after that, it will be reworked. |
@JunTaoLuo I noticed a new problem related to all this I think. If you run this following command in the fixed version of the PR you gave me you get the following error: Command
Error
If you lock SampleMVC.csproj |
Updating all NuGets fixed this issue somehow. |
FYI, there's currently ongoing work with how references to Microsoft.AspNetCore.App should work, see dotnet/sdk#2501. |
And update on my previous comment #6430 (comment) in which I said
Part of this has changed. We still believe the implicit package version is confusing, but after testing and experimenting with alternatives, we do not have a solution for 2.1 or 2.2 that we feel is significantly better. We are planning to change course in 3.0 and rework how this all works, but that is pretty far away. Therefore, our recommendation for now is that users reference Microsoft.AspNetCore.App like this: <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> We have made a few changes to the 2.2 SDK to make this work better for test projects, and will continue to improve our docs and guidance for how to deal with the issues with this design. Again, we hope to fix many of these issues in 3.0 with a refactoring of the way shared frameworks are referenced. |
@natemcmaster Thanks a lot for keeping us up to date. Looking forward to 2.2 and removing the .Web SDK from my test projects. |
When I use implicit version, I get a
The exception is the following:
Changing implicit to explicit I created a new issue for this because it seems to be specific to having a reference to signalr.. |
@nalla please use dotnet/aspnetcore#3503 for that problem. It includes workarounds in the description. |
I have a netstandard2.0 class library that references some AspNetCore packages. Do I target reference the 2.2.0 version of these packages, or 2.2.1/2.2.2 where available? |
I am wondering a similar question. @stijnherreman are you asking the same thing as this? dotnet/aspnetcore#8626 (comment) |
@VictorioBerra I think that's a different issue, related to aspnet/Announcements#324. |
I have a simple netcoreapp2.1 framework dependent Web API application that contains an implicit reference to the Microsoft.AspNetCore.App package. And, I have specified a RuntimeFrameworkVersion to indicate that the application must use a minimum runtime patch version; in this case version 2.1.9. I am trying to test the behavior when only runtime patch version 2.1.8 is installed. I am expecting an error to occur as described in the following document: https://docs.microsoft.com/en-us/dotnet/core/versions/selection The application runs without error and upon inspection, the dotnet.exe process is using runtime patch version 2.1.8. This is not desirable. Without doing a self-contained deployment, how can I force the Web API application to use a minimum runtime patch version and fail if the required runtime is not installed? I think I am missing some key fundamental. Roll-forward behavior is acceptable, but roll-backward behavior is not. |
I definitely find the implicit version confusing, because I want to be able to change a version on the metapackage for things like aspnet/Announcements#239 -- I would expect new versions of packages all the way up to Microsoft.AspNetCore.App to be published such that they no longer accept the insecure transitive dependency so that I don't need to add new dependencies on things I get from the metapackage just to avoid insecure packages. |
@scottmcm your feedback is consistent with what many others have said about this design. This feedback was part of the motivation for refactoring the way Microsoft.AspNetCore.App works in 3.0. One of the major changes here is that Microsoft.AspNetCore.App will no longer be a NuGet package at all, so you won't have to worry about metapackage versions and transitive dependencies and their related problems. |
Thanks, @natemcmaster. I'll look forward to 3.0 then. |
Leave comments/questions about the Microsoft.AspNetCore.App implicit version.
Copy from
@natemcmaster
After reviewing customer feedback and lots of design discussion, we think the implicit package version has created more confusion than help. We are planning to change course and go back to recommending using the Version attribute on the PackageReference to Microsoft.AspNetCore.App/All.
See dotnet/aspnetcore#3292.
The text was updated successfully, but these errors were encountered: