graphql-dotnet icon indicating copy to clipboard operation
graphql-dotnet copied to clipboard

Unable to Install Package in VS 2017 with Core 2.0

Open AlexNOliveira opened this issue 9 years ago • 11 comments

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.

" $(PackageTargetFallback);dotnet "

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

AlexNOliveira avatar Aug 22 '17 21:08 AlexNOliveira

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 avatar Aug 22 '17 21:08 joemcbride

@joemcbride Here is the screenshot #403

mokeyish avatar Aug 23 '17 06:08 mokeyish

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

srini85 avatar Aug 27 '17 21:08 srini85

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>

srini85 avatar Aug 27 '17 23:08 srini85

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>

michaelpfister avatar Aug 28 '17 11:08 michaelpfister

@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

srini85 avatar Aug 29 '17 10:08 srini85

I had to get this up and working for my asp.net core 2.0 project, and opted to do the following;

  1. I copied all the code from GraphQL project and moved it into a brand new asp.net core 2.0 class library.
  2. 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.

ghstahl avatar Sep 19 '17 18:09 ghstahl

Latest version of master should've this fixed.

pekkah avatar Sep 26 '17 13:09 pekkah

great change! lovely!

srini85 avatar Sep 26 '17 20:09 srini85

this is still occuring when i get the package through nuget... when will this be updated?

jeinz11 avatar Oct 22 '17 07:10 jeinz11

@jeinz11 use the pre-release version.

joemcbride avatar Oct 22 '17 14:10 joemcbride