-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
error : The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version 2.1.2 would be used instead. #9656
Comments
I am having different issue. I have version 2.1.302 of SDK installed. But when creating new or opening old project, 2.1.0 is used and not the newer one. |
I have this issue by using 2.1.4 SDK on mac visual studio professional 7.6.4. |
The 2.1.4 SDK does not support 2.1. The first SDK to support 2.1 was 2.1.300. |
@matthid getting back to the original issue here, this happens because your createdeb target is trying to publish a self-contained app without using implicit restore, while when the app was restore, it was restored as a framework dependent apps. For FD apps, we always use the lowest version possible, so that it can run on most places. A FD app gets roll forward to the latest patch available on the machine by the host during runtime. For a self-contained app, it is the opposite, we want it to use the highest version of the runtime that we know of at the publish time, so that it is as safe as possible. Your solution above is not really recommended. We don't recommend running the restore target along with other targets, as restore itself may bring down props/targets that will not be included in that evaluation/build when done this way. What you can try to do is invoke msbuild with Other than that, this is the expected behavior when the versions don't match. We prefer to fail than to let you publish a potentially not safe app by mistake. Let me know if my suggestion above does not work. |
Is there a way to enable implicit restore for that target? Or is this some magic only available for a fixed set of targets? I 'll try your suggestion soon, thanks! |
@livarcocc Indeed your suggestion with |
I'm using...
.. and getting ...
|
I had the very same issue just now, but with 2.1.5. Then I have downloaded the SDK installer directly, which has installed 2.1.6. Now I had the same issue with 2.1.6. At this point, I have added the proper |
I just did what zorgoz did. Now I got this...
|
@jwbats what does your project look like? Are you adding win10-x64 as a RuntimeIdentifier? You should be using win-x64 instead. |
@livarcocc I was indeed using win10-x64 as a RuntimeIdentifier. Incorrectly so, because my publish command (which I stuffed into a .bat file) was already making use of win-x64. So that's the RID I intended to use. Anyway, I used win-x64 like you suggested and I can now build my project from the CLI without it causing an error in my project. I thank you for finally solving this thorn in my side, which had been there for too many weeks. When I first created my project, VS did not put those properties in my csproj. Why does this work like this? Are TargetLatestRuntimePatch and RuntimeIdentifiers required properties now? Why does my VS build not cause errors, but my CLI build does (without these props)? Why does the csproj allow for the setting of multiple RunTimeIdentifiers? You can only build for one RID at a time, and you define this in your CLI publish command. |
Generally I'd like to know if this "breaking" change was intended and bring up awareness if it wasn't.
If everything is fine I'm happy with the workaround but would like to understand why I can no longer call
dotnet restore
in a separate call.Steps to reproduce
The error appeared after updating to 2.1.302 from 2.1.300, Basically after this commit
Expected behavior
Works as it did in 2.1.300
Actual behavior
Workaround
The workaround was to not try to call the "Restore" and "CreateDeb" separately, but on the same call:
Basically, I now call
msbuild /t:Restore;CreateDeb
instead of firstdotnet restore
followed bymsbuild /t:CreateDeb
...Commit fixing the issue
Related issues
Environment data
The
CreateDeb
target is imported from https://github.com/qmfrederik/dotnet-packagingProject File:
(see diff of the workaround)
dotnet --info
output (But really it happened on all CI systems):The text was updated successfully, but these errors were encountered: