Skip to content
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

Unable to publish project on Linux on 2.1 Preview 2 #2207

Closed
karelz opened this issue May 2, 2018 · 21 comments
Closed

Unable to publish project on Linux on 2.1 Preview 2 #2207

karelz opened this issue May 2, 2018 · 21 comments
Assignees
Milestone

Comments

@karelz
Copy link
Member

karelz commented May 2, 2018

From @danwalmsley on April 25, 2018 15:57

Hi, my project built and published no problem on 2.0 and 2.1 Preview 1

but now I get:

/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio.Languages.Xaml/AvalonStudio.Languages.Xaml.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.0.6 to 2.0.0. Reference the package directly from the project to select a different version.  [/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio/AvalonStudio.csproj]
/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio.Languages.Xaml/AvalonStudio.Languages.Xaml.csproj : error NU1605:  AvalonStudio.Languages.Xaml -> Avalonia.Designer.HostApp -> Microsoft.NETCore.App (>= 2.0.6)  [/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio/AvalonStudio.csproj]
/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio.Languages.Xaml/AvalonStudio.Languages.Xaml.csproj : error NU1605:  AvalonStudio.Languages.Xaml -> Microsoft.NETCore.App (>= 2.0.0) [/home/dan/repos/AvalonStudio/AvalonStudio/AvalonStudio/AvalonStudio.csproj]

AvalonStudio.csproj is a netcoreapp2.0 project.
AvalonStudio.Languages.Xaml.csprojis a netcoreapp2.0 project
Avalonia.Designer.HostApp is also a netcoreapp2.0 project.

The previous version was happy with this.

The repository containing the code at specific commit to repro is here:
VitalElement/AvalonStudio@e947164

git clone --recursive
cd AvalonStudio\AvalonStudio\AvalonStudio
dotnet publish -c Release -f netcoreapp2.0 -r debian.8-x64

Let me know if I can provide any further information.

Thanks in advance.

Copied from original issue: dotnet/coreclr#17774

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @RussKeldorph on April 25, 2018 19:18

@danmosemsft @karelz

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @danmosemsft on April 27, 2018 20:37

@steveharter any idea where this should go?

@karelz
Copy link
Member Author

karelz commented May 2, 2018

Aren't these NuGet errors?
@danwalmsley did you retarget your project to 2.1 Preview2? Does it fail only during publish, or also during build?
Are you able to minimize the repro to standalone projects referencing the suspicious NuGet packages?

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @danwalmsley on April 29, 2018 19:39

@karelz dotnet build works on its own.

I left the project files as they were .netcoreapp2.0.

I will have a go at minimizing the repro.

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @danwalmsley on April 30, 2018 15:53

@karelz the references are Project references not Nuget packages.

Im trying to get you a minimal repro asap.

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @RussKeldorph on May 1, 2018 17:20

@karelz Do we know enough to say where this bug should be tracked? Do we know if it might require a 2.1 fix?

@karelz
Copy link
Member Author

karelz commented May 2, 2018

From @danwalmsley on May 2, 2018 17:0

Repro.zip
Ok sorry for the delay here is a repro of the issue.

Extract the zip file.

Install dotnet 2.1 preview 2

cd into AvalonStudio.Languages.Xaml directory.

run dotnet publish -f netcoreapp2.0 -r win7-x64

you will get the error,

uninstall the preview and go back to version 2 sdk.

run the publish command again, it will work.

@danwalmsley
Copy link

Also id like to state that this is not Linux specific, I can also repro this on Widows too.

@danwalmsley
Copy link

The output on v2.0 sdk:

PS C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml> dotnet publish -f netcoreapp2.0 -r win7
-x64
Microsoft (R) Build Engine version 15.6.84.34536 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\Avalonia.Ide.CompletionEngine.csproj...
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.csproj...
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj...
  Restore completed in 711.06 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\Avalonia.Ide.CompletionEngine.csproj.
  Restore completed in 711.05 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.csproj.
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj...
  Restore completed in 780.01 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj.
  Restore completed in 408.26 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj.
  Avalonia.Designer.HostApp -> C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\bin\Debug\netcoreapp2.0\Avalonia.Designer.HostApp.dll
  Avalonia.Ide.CompletionEngine -> C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\bin\Debug\netstandard1.4\Avalonia.Ide.CompletionEngine.dll
  Avalonia.Ide.CompletionEngine.SrmMetadataProvider -> C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\bin\Debug\netstandard1.4\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.dll
  AvalonStudio.Languages.Xaml -> C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\bin\Debug\netcoreapp2.0\win7-x64\AvalonStudio.Languages.Xaml.dll
  AvalonStudio.Languages.Xaml -> C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\bin\Debug\netcoreapp2.0\win7-x64\publish\

the output on 2.1 preview 2

PS C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml> dotnet publish -f netcoreapp2.0 -r win7
-x64
Microsoft (R) Build Engine version 15.7.145.53551 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj...
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\Avalonia.Ide.CompletionEngine.csproj...
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.csproj...
  Restore completed in 542.31 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\Avalonia.Ide.CompletionEngine.csproj.
  Restore completed in 542.32 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.csproj.
  Restoring packages for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj...
  Generating MSBuild file C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\obj\Avalonia.Designer.HostApp.csproj.nuget.g.props.
  Generating MSBuild file C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\obj\Avalonia.Designer.HostApp.csproj.nuget.g.targets.
  Restore completed in 734.86 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj.
C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.0.6 to 2.0.0. Reference the package directly from the project to select a different version.
C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj : error NU1605:  AvalonStudio.Languages.Xaml -> Avalonia.Designer.HostApp -> Microsoft.NETCore.App (>= 2.0.6)
C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj : error NU1605:  AvalonStudio.Languages.Xaml -> Microsoft.NETCore.App (>= 2.0.0)
  Restore failed in 381.15 ms for C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj.
PS C:\Users\dan\dev\repos\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml>

@livarcocc
Copy link
Contributor

cc @dsplaisted

@livarcocc livarcocc added this to the Discussion milestone May 2, 2018
@dsplaisted
Copy link
Member

@danwalmsley This was broken by #2085. As a workaround, you should be able to put the following in a PropertyGroup in AvalonStudio.Languages.Xaml.csproj:

<TargetLatestRuntimePatch Condition="'$(RuntimeIdentifier)' != ''">true</TargetLatestRuntimePatch>

The bug is that if a .NET Core project with an OutputType of Library references one with an OutputType of Exe, you will get a failure if you try to do a self-contained publish. This is because the Exe will roll-forward to the latest patch of .NET Core, but the app won't, leading to NuGet complaining about a package downgrade.

Can you help me understand why Avalonia is doing a self-contained publish of a library? That's not the only way you could run into this issue (in general restoring, building, or publishing a project with a RID specified and where there is a library referencing an Exe would hit it), but I don't think doing a self-contained publish on a library is something we designed for, so you might run into other issues.

@dsplaisted dsplaisted modified the milestones: Discussion, 2.1.4xx May 3, 2018
@dsplaisted dsplaisted self-assigned this May 3, 2018
@danwalmsley
Copy link

Thanks for the explanation, I'm only publishing a library for the repo. My actual use case is that this is normally referenced by an executable project which is how I came across it.

Thanks for the workaround 😀

@danwalmsley
Copy link

danwalmsley commented May 3, 2018

@dsplaisted I added the property, but I now get a different error:

PS C:\dev\repos\Repro\AvalonStudio.Languages.Xaml> dotnet publish -f netcoreapp2.0 -r win7-x64
Microsoft (R) Build Engine version 15.7.145.53551 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 70.9 ms for C:\dev\repos\Repro\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine\Avalonia.Ide.CompletionEngine.csproj.
  Restore completed in 66.9 ms for C:\dev\repos\Repro\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj.
  Restore completed in 70.87 ms for C:\dev\repos\Repro\Avalonia.Ide\src\Avalonia.Ide.CompletionEngine.SrmMetadataProvider\Avalonia.Ide.CompletionEngine.SrmMetadataProvider.csproj.
  Restore completed in 66.88 ms for C:\dev\repos\Repro\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj.
  You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452
  You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452
C:\dev\repos\Repro\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj : 
error : The project was restored using Microsoft.NETCore.App version 2.0.6, but with current settings, version 2.0.0 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.

@dsplaisted
Copy link
Member

@danwalmsley I wasn't able to actually build the repro because I had the following restore errors. So I didn't hit the build issue you encountered. Is there a NuGet feed I need to add to be able to restore these packages?

C:\Users\daplaist\source\repos\Avalonia\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj error NU1102: Unable to find package Avalonia.Desktop with version (>= 0.6.2-build4964-beta)
  - Found 5 version(s) in nuget.org [ Nearest version: 0.6.1 ]
  - Found 0 version(s) in local debug
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in CliFallbackFolder
  - Found 0 version(s) in dotnet-core MyGet
  - Found 0 version(s) in nuget-build MyGet [C:\Users\daplaist\source\repos\Avalonia\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj]
C:\Users\daplaist\source\repos\Avalonia\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj error NU1605: Detected package downgrade: System.IO.FileSystem.Primitives from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version. 
 AvalonStudio.Languages.Xaml -> Avalonia.Ide.CompletionEngine -> Newtonsoft.Json 9.0.1 -> System.Xml.ReaderWriter 4.0.11 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.IO.FileSystem.Primitives (>= 4.3.0) 
 AvalonStudio.Languages.Xaml -> Avalonia.Ide.CompletionEngine -> Newtonsoft.Json 9.0.1 -> System.Xml.ReaderWriter 4.0.11 -> System.IO.FileSystem.Primitives (>= 4.0.1) [C:\Users\daplaist\source\repos\Avalonia\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj]
C:\Users\daplaist\source\repos\Avalonia\Avalonia.Designer.HostApp\Avalonia.Designer.HostApp.csproj error NU1102: Unable to find package Avalonia.Desktop with version (>= 0.6.2-build4964-beta)
  - Found 5 version(s) in nuget.org [ Nearest version: 0.6.1 ]
  - Found 0 version(s) in local debug
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in CliFallbackFolder
  - Found 0 version(s) in dotnet-core MyGet
  - Found 0 version(s) in nuget-build MyGet [C:\Users\daplaist\source\repos\Avalonia\AvalonStudio.Languages.Xaml\AvalonStudio.Languages.Xaml.csproj]

@danwalmsley
Copy link

@danwalmsley
Copy link

just so you know I'm still getting this on RC1.

@danwalmsley
Copy link

If I retarget the projects to all be .netcoreapp2.1 then it will publish, but still need a fix / workaround so I can target 2.1

@danwalmsley
Copy link

any update?

@danwalmsley
Copy link

@dsplaisted

@dasMulli
Copy link
Contributor

@danwalmsley you will need to add

  <PropertyGroup>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
  </PropertyGroup>

to the host app project as well for this error.

Or publish using

dotnet publish -f netcoreapp2.0 -r win7-x64 -p:TargetLatestRuntimePatch=true

@danwalmsley
Copy link

Thanks finally I managed to get the workaround to work :)

@livarcocc livarcocc modified the milestones: 2.1.4xx, Discussion Jun 28, 2018
Workshop2 added a commit to noobot/noobot that referenced this issue Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants