Restore hangs when referenced project targets only .net standard 2.0
See original GitHub issueFrom @MNie on April 6, 2018 20:53
Steps to reproduce
- Try to install an Expecto Template via
dotnet new -i Expecto.Template
Expected behavior
- Everything is ok, the template is installed as expected.
Actual behavior
$ dotnet new -i Expecto.Template
...
...
~/.templateengine/dotnetcli/v2.1.4/scratch/restore.csproj : error NU1202: Package Expecto 7.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Expecto 7.0.0 supports:
~/.templateengine/dotnetcli/v2.1.4/scratch/restore.csproj : error NU1202: - net461 (.NETFramework,Version=v4.6.1)
~/.templateengine/dotnetcli/v2.1.4/scratch/restore.csproj : error NU1202: - netstandard2.0 (.NETStandard,Version=v2.0)
Generating MSBuild file ~/.templateengine/dotnetcli/v2.1.4/scratch/obj/restore.csproj.nuget.g.props.
Generating MSBuild file ~/.templateengine/dotnetcli/v2.1.4/scratch/obj/restore.csproj.nuget.g.targets.
Restore failed in 6.24 sec for ~/.templateengine/dotnetcli/v2.1.4/scratch/restore.csproj.
- Installation hangs with an error that Expecto library doesn’t support .net core 1.0 (Expecto supports .net standard 2.0, and drops support to .net standard 1.6 after 7.0 release).
- When we cancel the installation, regardless of the error from point 2, a template would be installed properly.
Environment data
dotnet --info
output:
.NET Command Line Tools (2.1.103)
Product Information:
Version: 2.1.103
Commit SHA-1 hash: 60218cecb5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.103\
Microsoft .NET Core Shared Framework Host
Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d
Copied from original issue: dotnet/cli#9017
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Issues with .NET Standard 2.0 with .NET Framework & NuGet
The project file contains no references to any assets as the assets are selected at build time. Package restore will compute the graph...
Read more >The current .NET SDK does not support targeting . ...
I want to create a class library project with Target Framework .NET Standard 2.0. I've updated my Visual Studio 2017 to Version 15.3...
Read more >Troubleshooting NuGet Package Restore in Visual Studio
This error occurs when you attempt to build a project that contains references to one or more NuGet packages, but those packages are...
Read more >NET Standard
This compatibility mode allows .NET Standard projects to reference .NET Framework libraries as if they were compiled for .NET Standard.
Read more >Multi-targetting .Net Framework and .Net Core in a single project
A 15-second guide and 15-minute walk through. You have a .Net Core project, whether a netstandard library, or a netcore app, and you'd...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried this out and took a look at the template package. The template package’s target framework is OK (not specified). As far as the hang goes, it turns out (at least on Windows, I haven’t tried this on my mac yet) that this isn’t actually a hang. Because of the way that the template is authored (where the libraries used by the template are referenced in the template package itself) the installation process ends up looking through all of the types in all of the DLLs that are restored by the dependencies to see if there are any components that are required for making the template - this process takes a long time (multiple minutes) but does eventually complete, discovering the contained templates and no “components”.
The nupkg containing the template currently has a NuSpec that looks like this:
Changing it to this:
Should dramatically speed up the installation process (getting it down to a second or so).
Sounds interesting, I’d suggest filing an issue on NuGet/Home to get their thoughts on it.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Michał Niegrzybowski notifications@github.com Sent: Tuesday, April 10, 2018 3:52:10 AM To: dotnet/templating Cc: Mike Lorbetske; Mention Subject: Re: [dotnet/templating] Restore hangs when referenced project targets only .net standard 2.0 (#1506)
@mlorbetskehttps://github.com/mlorbetske I’m not 100% sure if a description is a right place for something like that. Maybe it would be doable to create some section on NuGet page, which will write all dependencies from some special section in a nuspec if it is a DotNet Core template? Wouldn’t be that a good idea?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/templating/issues/1506#issuecomment-380057451, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABWXUeX6Xn-RRnL5s1SsA6cac4AN25Gqks5tnI7agaJpZM4TKxrM.