-
Notifications
You must be signed in to change notification settings - Fork 10k
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
After upgrading to ASP.NET Core 2.1, get error that project will use 2.1.0-rc1. How to fix? #3221
Comments
Thanks for contacting us, @Tgueth. |
I have similar error:
Please see attached a new project, that I want to use with .Net 2.1.1 |
I have a similar problem:
|
I added the following lines to my .csproj files and this particular error went away
Now during testing I'm getting a series of errors similar to this [6/19/2018 5:48:54 PM Informational] ------ Run test started ------
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources) |
I solved it via adding a global.json to my Project with:
|
Running "dotnet --info" in the Package Manager Console yielded:
I installed dotnet-hosting-2.1.1-win(1).exe from actually version 2.1.1 Product build: cli build 20180605-09-1764970 and it seems to have resolved the problem with tests
|
Removing |
I'm getting this same error on publish as well. |
It turns out this feature is explicitly outlines in the docs. In my case My publish was using a different runtime because I was publishing using Any CPU. If none of the other options outline work for you the easiest way to avoid this issue is to build using the same configuration that you want to publish using and then run |
All, thanks very much for your thoughts in this issue. Given the docs @granthoff1107 mentioned, are there any open questions here? |
@dougbu, It will be nice to have error message be more csproj specific, suggest RuntimeFrameworkVersion and global.json setting as possible fixes and include a link to the article explaining possible reasons/solutions for the error. |
@MNF I don’t use the Cli either that’s just a quote from the docs. I solved my issue by matching my configuration for publishing to the configuration for my build, and then everything started working. My post was more help other find a work around, it seems like this is a known issue, and my guess is Microsoft will fix this in a few builds. In my opinion this is still a bug, there’s no reason I should use these work arounds, considering visual studio stores your build and publish configurations, it should know how to resolve this. |
@granthoff1107, sorry, I meant to address my comment to @dougbu |
Sorted changing <TargetFramework>netcoreapp2.0</TargetFramework> to: <TargetFramework>netcoreapp2.1</TargetFramework> |
I had this problem and adding
to the .csproj as suggested by @ewmccarty worked. Note: didn't need the |
Holy crap... removing I was getting this error:
guess what: I had the |
Thanks to @AliDoganKim, he's answer worked for me. (@MNF link edited ! tnx ) |
@emrecavunt , the link in your post is not working, but the url |
@JunTaoLuo does the following error come from the Web SDK or anything else our group handles? (If not, seems we should redirect any remaining questions on this long thread to the CLI team.)
|
Adding <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup> You can also set the nuget app version: <PackageReference Update="Microsoft.NETCore.App" Version="2.1.0" /> Reference: https://stackoverflow.com/a/51404441 |
@JunTaoLuo ping |
There seems to be multiple issues here so there's also no specific fix. However, we do have documentation at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.1 to explain how the metapackages should be used. In general, we recommend not explicitly specifying the <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project> This is what our templates currently produce and we recommend following this pattern if you are upgrading from previous releases (1.x and 2.0 templates will look different for example). In cases where explicit references are added and explicit versions are specified, (either directly on the dependency or via properties such as
Due to these extra precautions required, we recommend using implicit versions as much as possible to avoid errors and conflicts as mentioned above. I'm not familiar enough with the VS tooling, templates, and publish/deployment scripts to say how the errors reported in this issue came about. To address specific concerns, the project file I saw in The self-contained deployment route will have a separate set of considerations and it is outlined in https://docs.microsoft.com/en-us/dotnet/core/deploying/runtime-patch-selection. Note that the implicit metapackage versions have also caused a separate set of confusion and difficulties for users and we considered alternatives in #3292. Although we did not choose to revert back to explicit versions in 2.1.x, further discussions regarding this area are ongoing and may change in the future. Since the problems outlined in this issue may have different causes, please feel free to file a new issue and link your project file and environment (i.e. |
@JunTaoLuo Thank you for the detailed answer. I found it helped me actually understand the cause of the problem, which I very much prefer, to a simple fix. (Duct taping things always bites me.) |
For anyone who got here having this problem. |
What max-favilli said... |
I'm going to close this issue now since I think most of the issues have been addressed. Please feel free to open new issues in case anyone has more specific questions! |
This worked for me as well! Make sure you add this line to all included .csproj files in your solution. |
switched in project properties from Target from AnyCPU to x64, clean, rebuild, no error this time. |
adding this true works for me |
As per issue details here: dotnet/aspnetcore#3221 (comment)
Here is the error I receive when I build the application after upgrading to 2.1,
The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore.
The error refers to line 1 in csproj, but line 1 does not refer to rc1. How do I fix this?
The text was updated successfully, but these errors were encountered: