-
Notifications
You must be signed in to change notification settings - Fork 147
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
netstandard2.0 references projects which is invalid for netframework #383
Comments
Hi @simendsjo I'm not 100% sure what needs to happen - is this on the 4.x version of the client? Thanks! |
Yes, it's the 4.x client I'm trying to upgrade to. I know what the problem is, but I'm not sure what the best fix is -- the situation is chaotic. Everyone "does the right thing", but because of Microsofts failed out-of-band updates, special care needs to be taken to not break netframework. The problem with having these in netstandard is that they refer to versions that doesn't exist in netframework, and netframework cannot mix and match these core packages from nuget and netframework. Microsoft tried that with System.Net.Http, which caused a lot of pain. netstandard is supposed to be the common ground for netframework and netcore, but the versions available in nuget and netframework doesn't match. My proposed fix here will at least work for netframework as it picks up netstandard, and it only contains packages which should be used from nuget, and not the packages which should be used from framework. Will it cause problems for other netstandard implementations..? Maybe? Probably? Do we care? The big players for this library is probably netcore and netframework, so at least those needs to be working. Maybe a better fix will be a custom block for netframework instead of a block for netcore as it's (hopefully) just netframework which has these issues? |
EDIT: Looks like these will add references to the project files. The real fix seems to be in having it's own section for netframework to avoid adding the System.Net* packages. So this will be the "Maybe a better fix.."-approach I mentioned last. Hmm, I see EventStore has a section using frameworkAssemblies in the nuspec file. Maybe this is Microsofts recommended workaround for this issue? <dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="Newtonsoft.Json" version="11.0.2" exclude="Build,Analyzers" />
<dependency id="protobuf-net" version="2.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.6">
<dependency id="Newtonsoft.Json" version="11.0.2" exclude="Build,Analyzers" />
<dependency id="protobuf-net" version="2.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Newtonsoft.Json" version="11.0.2" exclude="Build,Analyzers" />
<dependency id="System.Net.Http" version="4.3.4" exclude="Build,Analyzers" />
<dependency id="System.Net.Requests" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Net.Security" version="4.3.2" exclude="Build,Analyzers" />
<dependency id="protobuf-net" version="2.4.0" exclude="Build,Analyzers" />
</group>
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Net.Http" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
<frameworkAssembly assemblyName="System.Net.Http.WebRequest" targetFramework=".NETFramework4.5.2, .NETFramework4.6" />
</frameworkAssemblies> |
OK, so just so I think I've got this right in my head. The version of The problem is caused because when you try to use |
As EventStore is correctly defined, this isn't what happens. For netframework, If on the other hand .NETFramework4.6 wasn't defined, as is the case for In effect, you're saying things like "download and use library A v2 from nuget", So while netframework implements netstandard, it doesn't necessarily have the ... so it's a messy situation. As far as I understand, Microsoft has given up And even though it's an issue for all of framework, you only get into the Hopefully NET5 will make it easier for us to upgrade so I no longer care about |
I see that the nuspec file is correct in the repository, but not in nuget |
OK, so, the CI is using But I still don't know how to fix this. I don't know what to do that would get it working. I'm also confused by your mention of I'd like to help, but I don't know how. |
OK, if I get the chance today, I'll play with a pre-release version and see if that can use the nuspec properly. |
Did you get around to test this? |
Not in the CI - largely as I've gone through the i.e. is it just a NET 4.6.2 project with references from Neo4jClient and...? |
You need to create a redirect for the version your nuspec targets and then try to use the version from framework. In the following project I did "New ASP.NET project", "paket convert-from-nuget", added "redirects:force", and then added "Neo4jClient". After adding Neo4jClient, it no longer works as Neo4j specifies a version from nuget which isn't the same version as exist in netframework: simendsjo/neo4jclient-netframework-package-problems@8d74a28 |
Would you be able to try https://www.nuget.org/packages/Neo4jClient/4.1.5-experimental-5 ? |
It will still clash with netframework. Our local hack is to replace this in the nuspec file <dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.CSharp" version="4.7.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.VisualBasic" version="10.3.0" exclude="Build,Analyzers" />
<dependency id="Neo4j.Driver.Signed" version="4.2.0" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="12.0.3" exclude="Build,Analyzers" />
<dependency id="System.ComponentModel.Annotations" version="5.0.0" exclude="Build,Analyzers" />
<dependency id="System.Dynamic.Runtime" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies> With this <dependencies>
<group targetFramework="net472">
<dependency id="Neo4j.Driver.Signed" version="4.2.0" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="12.0.3" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.CSharp" version="4.7.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.VisualBasic" version="10.3.0" exclude="Build,Analyzers" />
<dependency id="Neo4j.Driver.Signed" version="4.2.0" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="12.0.3" exclude="Build,Analyzers" />
<dependency id="System.ComponentModel.Annotations" version="5.0.0" exclude="Build,Analyzers" />
<dependency id="System.Dynamic.Runtime" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies> I guess "net45" should also work and will work for more than just net472. |
Hmmmm It's packaged from the
Which looks like what you have, https://www.nuget.org/packages/Neo4jClient/4.1.5-experimental-7 Is the most recent one, which has all of that. I don't know how to get nuget to pick it up |
Maybe it help to add the framework to TargetFrameworks in the csproj file? The netstandard build should work on netframework, but perhaps nuget does some filtering here? |
Hmmm, that is proving complicated |
Assemblies which has been added out-of-band to nuget, should not be referenced for netframework projects. As netstandard2.0 is usef for both netcore and netframework, adding such assemblies to netstandard, will break netframework projects. The versions referenced, will not be the same versions as those included in netframework, so tools will generate wrong binding redirects for instance. These out-of-band packages is a continuous source of problems for netframework projects.
I'm not up to speed with the current version of the library. I see there's a nuspec in the project, which looks correct, but the nuspec in the nuget repository is wrong
Modifying the nuspec file manually and maintaining our own package works, but it's better to fix this upstream
The text was updated successfully, but these errors were encountered: