dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.67k stars 1.06k forks source link

Visual Studio for mac Microsoft.AspNetCore.App downgrade Error #2586

Open kwonmoose opened 5 years ago

kwonmoose commented 5 years ago

I am Korean. I wrote it by translating it into Google Translator. Thank you for your patience.

Currently I am using Visual Studio for Mac and I am developing API and WebSite with dotnet core. The first version that started development is 2.1.1, and when 2.1.2 comes out, it tries to update it and gives up as a downgrade phenomenon and tries to update to 2.1.5 version now. The same as last time 2.11 downgrade phenomenon appears, it does not appear on windows, but it is only on mac. I've tried adding the TypeScriptCompileBlocked and RuntimeFrameworkVersion tags to the project file, but the same symptoms are happening. I can not find the exact cause why this is happening.

livarcocc commented 5 years ago

Can you copy/paste the error message you are getting and/or your csproj?

kwonmoose commented 5 years ago

Can you copy/paste the error message you are getting and/or your csproj?

@livarcocc

There are two types of error messages.

Error NU1605: Detected package downgrade: Microsoft.AspNetCore.App from 2.1.5 to 2.1.1. Reference the package directly from the project to select a different version. Error: NETSDK1061: Your project has been restored using Microsoft.NETCore.App version 2.1.0, but the current setting uses version 2.1.5 instead. To resolve this issue, you must use the same settings for the restore and subsequent tasks (for example, build or publish). Typically, this problem can occur if the RuntimeIdentifier property was set during build or posting but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection. Message 1 is frequently displayed. Sometimes message 2 is exposed.

ps. The second message was translated into Korean and translated into Google Translator.

livarcocc commented 5 years ago

This probably indicates that you have hard-coded versions of these dependencies on your csproj. Or, you may be missing something on them.

Would it be possible for you to paste the contents of the csprojs here?

kwonmoose commented 5 years ago

This probably indicates that you have hard-coded versions of these dependencies on your csproj. Or, you may be missing something on them.

Would it be possible for you to paste the contents of the csprojs here?

`

netcoreapp2.12.1.5
<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
  <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
  <PackageReference Include="NLog.Web.AspNetCore" Version="4.7.0" />
  <PackageReference Include="RabbitMQ.Client" Version="6.0.0-pre3" />
</ItemGroup>   
<ItemGroup>
  <ProjectReference Include="..\_KuaiGolfService\_KuaiGolfService.csproj" />
</ItemGroup>
<ItemGroup>
    <Content Update="NLog.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
  <Compile Remove="Common\WebSocketUtil\SocketManager.cs" />
</ItemGroup>

`

My project is a csproj file. There are several projects in one solution, but only one is shared. But almost all of them are like this. You have added RuntimeFrameworkVersion, which is one of the workaround solutions. (All projects) However, there is still a downgrade phenomenon, and the downgrade from 2.1.5 to 2.1.1 is so frequent that I have been downgrading to version 2.1.1 and I am still looking for a solution.

livarcocc commented 5 years ago

Does this happen during publish?

kwonmoose commented 5 years ago

이 문제는 게시하는 동안 발생합니까?

No project open and build errors. I do not get an error when publishing, but I did not check if the version being published is 2.1.5 or 2.1.1.

livarcocc commented 5 years ago

Can you provide us with a binlog? you can get one by running dotnet build /bl on the failing project and then sharing the .binlog file.

Note that if you have secrets in your project, they will be logged in this binlog.

kwonmoose commented 5 years ago

Can you provide us with a binlog? you can get one by running dotnet build /bl on the failing project and then sharing the .binlog file.

Note that if you have secrets in your project, they will be logged in this binlog.

I tried to try it with the method you provided, but if you run Visual Studio again after you update the Visual Studio, it will be 2.1.1 at first, then change to 2.1.5 after a few seconds without updating.

livarcocc commented 5 years ago

This should not be specific to VS. Just drop to the command line and run the command I suggest. If it also fails there, then please share the log file. Without it, it will be very hard to help you.

kwonmoose commented 5 years ago

This should not be specific to VS. Just drop to the command line and run the command I suggest. If it also fails there, then please share the log file. Without it, it will be very hard to help you.

We will share the binlog file obtained by running the "dotnet build /bl" command in the project.

msbuild.binlog.zip

kwonmoose commented 5 years ago

This should not be specific to VS. Just drop to the command line and run the command I suggest. If it also fails there, then please share the log file. Without it, it will be very hard to help you.

Is there no solution for this phenomenon?