Unable to Install Package in VS 2017 with Core 2.0
Hi,
I tried to create a .NET Core 2.0 class library project in VS 2017 (15.3.2) to use GraphQL but Nuget is unable to install the package, even via Package Console. I end up with the message "package restore failed. rolling back package changes..." in the Error output console.
I found an workaround that suggests to add the lines below to the csproj file. I did, but it didn't work for me.
"
In the page where I found the workaround, it says "This is happening because the maintainer hasn't updated the NuGet package with .NET Standard targets.". I am not sure if is the real problem..
If I change the Target Framework to .NET Core 1.1, I am able to install the package.
Thanks in Advance, Alexandre
Thanks for the heads up! I haven't tried this yet myself. I probably won't be getting around to looking at this till next week. Was there a more detailed error available? I believe you can see that in VS in the Output window, though should be able to see it for sure if you use dotnet restore on the command line.
@joemcbride Here is the screenshot #403
I had this issue as well. I decided to upgrade the project to dotnet core 2.0 and created a PR
https://github.com/graphql-dotnet/graphql-dotnet/pull/409
you can also get around the issue by forcing your project to use 4.1.0 of System.Reflection.TypeExtensions
E.g.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="graphql" Version="0.17.2" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.1.0" />
</ItemGroup>
</Project>
Thanks @srini85 this helped me getting it back working. For my netcoreapp2.0 I had to use some newer packages however, 4.1.0 of the TypeExtensions wasn't enough:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphQL" Version="0.17.2" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
</ItemGroup>
</Project>
@mpfisterUniBE may be might be better to use netstandard and then reference this in your netcoreapp. This way the library is portable if you choose to goto netframework. But if you don't have a need, leaving it as netcoreapp2 is ok
I had to get this up and working for my asp.net core 2.0 project, and opted to do the following;
- I copied all the code from GraphQL project and moved it into a brand new asp.net core 2.0 class library.
- I didn't change any code, this stuff is tight!
Now I have my own "Temporary" copy of this library which I will swap out when this one releases a 2.0 compliant one.
Passed all my unit test.
Anyway, that's the good news.
Latest version of master should've this fixed.
great change! lovely!
this is still occuring when i get the package through nuget... when will this be updated?
@jeinz11 use the pre-release version.