Fix install for .NET 4.0
See original GitHub issueWe removed support for .NET 4.0 in v1.11 (see #696). Our intent was that projects that still targeted .NET 4.0 would continue to see and install previous package versions that supported .NET 4.0.
Unfortunately, that’s not the case. An attempt to install Google.Apis.Storage.v1
in a project targeting .NET 4.0 today results in a compatibility error:
PM> install-package google.apis.storage.v1
Attempting to gather dependencies information for package 'google.apis.storage.v1.1.11.1.434' with respect to project 'NuGetNet40', targeting '.NETFramework,Version=v4.0'
Attempting to resolve dependencies for package 'google.apis.storage.v1.1.11.1.434' with DependencyBehavior 'Lowest'
Resolving actions to install package 'google.apis.storage.v1.1.11.1.434'
Resolved actions to install package 'google.apis.storage.v1.1.11.1.434'
Adding package 'Microsoft.Bcl.Build.1.0.21' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.Build.1.0.21' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.Build.1.0.21' to 'packages.config'
Successfully installed 'Microsoft.Bcl.Build 1.0.21' to NuGetNet40
Adding package 'Microsoft.Bcl.1.1.10' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.1.1.10' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.1.1.10' to 'packages.config'
Successfully installed 'Microsoft.Bcl 1.1.10' to NuGetNet40
Adding package 'Microsoft.Bcl.Async.1.0.168' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.Async.1.0.168' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Bcl.Async.1.0.168' to 'packages.config'
Successfully installed 'Microsoft.Bcl.Async 1.0.168' to NuGetNet40
Adding package 'Microsoft.Net.Http.2.2.29' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Net.Http.2.2.29' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Microsoft.Net.Http.2.2.29' to 'packages.config'
Successfully installed 'Microsoft.Net.Http 2.2.29' to NuGetNet40
Adding package 'Newtonsoft.Json.7.0.1' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Newtonsoft.Json.7.0.1' to folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Added package 'Newtonsoft.Json.7.0.1' to 'packages.config'
Executing script file 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages\Newtonsoft.Json.7.0.1\tools\install.ps1'
Successfully installed 'Newtonsoft.Json 7.0.1' to NuGetNet40
Install failed. Rolling back...
Package 'Google.Apis.Core.1.11.1 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Async [1.0.168, ), Microsoft.Bcl.Build [1.0.21, ), Microsoft.Net.Http [2.2.29, ), Newtonsoft.Json [7.0.1, )' does not exist in project 'NuGetNet40'
Removed package 'Newtonsoft.Json.7.0.1 : ' from 'packages.config'
Removed package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from 'packages.config'
Removed package 'Microsoft.Bcl.Async.1.0.168 : Microsoft.Bcl [1.1.8, )' from 'packages.config'
Removed package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from 'packages.config'
Removed package 'Microsoft.Bcl.Build.1.0.21 : ' from 'packages.config'
Package 'Google.Apis.Core.1.11.1 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Async [1.0.168, ), Microsoft.Bcl.Build [1.0.21, ), Microsoft.Net.Http [2.2.29, ), Newtonsoft.Json [7.0.1, )' does not exist in folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removing package 'Newtonsoft.Json.7.0.1 : ' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removed package 'Newtonsoft.Json.7.0.1 : ' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removing package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removed package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removing package 'Microsoft.Bcl.Async.1.0.168 : Microsoft.Bcl [1.1.8, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removed package 'Microsoft.Bcl.Async.1.0.168 : Microsoft.Bcl [1.1.8, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removing package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removed package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removing package 'Microsoft.Bcl.Build.1.0.21 : ' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
Removed package 'Microsoft.Bcl.Build.1.0.21 : ' from folder 'c:\users\matthew\documents\visual studio 2015\Projects\NuGetNet40\packages'
install-package : Could not install package 'Google.Apis.Core 1.11.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are
compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ install-package google.apis.storage.v1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
The best workaround at the moment is for customers to install the previous version explicitly:
Install-Package Google.Apis.Storage.v1 -Version 1.10<tab>
(Unfortunately NuGet also won’t do partial matching on the version.)
This isn’t acceptable and it isn’t the experience we intended to provide. We’re sorry for the break.
I still want to limit the maintenance burden of .NET 4.0 support, for the reasons I described in my comment in #696. The install experience has to work, but I’m okay with it leaving customers at v1.10.
With that in mind, some options I can think of:
- Add corresponding .NET 4.0 projects for support and generated libraries.
- Add .NET 4.0 projects only for generated (API-specific) libraries. Have the net40 versions depend on old versions of the support libraries.
- Build a final version of our 1.10 libraries and package them as Google.Apis.DotNet40. Add “null” net40 support to the generated and support libraries so they’ll still install, and add net40-specific dependencies on this other library. This is a slightly more elegant version of just checking in the built binaries.
Issue Analytics
- State:
- Created 7 years ago
- Comments:21 (9 by maintainers)
Top GitHub Comments
Yes, good point, I’ve added a few comments on stackoverflow
I wonder if he is trying to add each one by itself instead of just doing
If he is actually doing
It would of course tell him that it cant do that.