-
Notifications
You must be signed in to change notification settings - Fork 789
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
Reference changed to wrong version of assembly #3415
Comments
This looks like another instance of an issue that has been around for at least a couple of years now, which the NuGet and F# teams both seem to think that that other team will fix. This was reported back in September of 2015 in https://github.com/dotnet/corefx/issues/3103 as a Core FX bug, then shortly after that in October 2015 as a NuGet bug in NuGet/Home#1510 - both describe it as a problem with This seems to have been around as a bug for a very long time, but it is becoming increasingly problematic now that we're seeing more out-of-band releases of updates to framework DLLs via NuGet. Unfortunately there seems to be a bit of a muddle on who should fix it. The timeline so far as far as I can see is:
So in short, @dsyme said back in February 2016 that F# should fix this (even though it looked like NuGet also had an issue, and a NuGet fix might fix it for more people sooner). But the relevant issue #939 got closed without it apparently being fixed. We're going to start seeing a lot more examples of this I think, with the way .NET is evolving - it's now quite common to come across newer versions of assemblies that are also in the reference assemblies. |
@idg10 Is there a workaround by using a direct reference to the DLL in the package? |
So the workaround would be "delete the reference and add a direct DLL reference to packages\System.Net.Http.4.3.2\lib\net46\System.Net.Http.dll". However I don't know if that is robust under further package add/remove Another workaround is to use Paket. |
If you modify references directly in the It's possible I'm not doing exactly what you've suggested. I'm not 100% sure what a "direct DLL reference" really is. Looking at the docs for the Is that what you meant? If so, then I can confirm that Visual Studio will delete the I'm looking into Paket - a few people have mentioned it. But where I really want to get to is to be able to use |
Paket works fine with the new fsproj format but VS does not yet
Am 18.08.2017 9:52 vorm. schrieb "Ian Griffiths" <[email protected]>:
… If you modify references directly in the .fsproj that came from a NuGet
reference, Visual Studio seems to overwrite them any time you make any sort
of NuGet change - it seems to reset all NuGet-originated references.
It's possible I'm not doing exactly what you've suggested. I'm not 100%
sure what a "direct DLL reference" really is. Looking at the docs for the
<Reference> element at https://docs.microsoft.com/en-
us/visualstudio/msbuild/common-msbuild-project-items the only way I see
to specify the exact location of a file is through <HintPath>
Is that what you meant? If so, then I can confirm that Visual Studio will
delete the <HintPath> the next time you do add or update *any* package in
the project.
I'm looking into Paket - a few people have mentioned it. But where I
*really* want to get to is to be able to use <PackageReference> - the
only reason I have a reference to System.Net.Http at all is that my F#
project uses a NuGet package that in turn depends on it. In C# projects in
the same solution that are using the new type of project file I don't have
any direct references to System.Net.Http at all because the transitive
reference handling picks it up automatically. Will a move to Paket make it
harder to migrate to the new project file approach? (The main thing
stopping me using the new format already is that if you open an F# project
with an MSBuild 15 style .fsproj IntelliSense starts reporting spurious
errors.)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3415 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNIsG9nW3f0jcWv6fnRqAQKG2bxWKks5sZUKqgaJpZM4OsW3U>
.
|
So, 2 hours of attempting to convert to Paket and it appears that for some reason when I move my project over to that, Paket adds two separate references to And even after all this I'm getting this warning:
And this despite my If in VS's Solution Explorer I delete one of the relevant entries under the References node for the project, and change the other to require a specific version, the warning goes away, but then I'm back in much the same situation as I was with the NuGet workaround: you can make the problem go away by editing the So unfortunately Paket doesn't appear to solve my particular instance of this problem. I don't have a good workaround either with NuGet or Paket. Update: and yes, the manual edit does indeed get overwritten next time you change anything in Paket. Update 2: although I've now worked out what was making it do that. I've created an issue over at Paket: fsprojects/Paket#2629 - this means I can now use Paket to work around this issue, but the bug described in this issue remains if you can't use Paket. |
We had reports about system.http recently in paket. I'm planning to look at
this today or over the weekend. Something changed around it and I need to
investigate. So please don't give up on us here ;-)
Am 18.08.2017 12:20 schrieb "Ian Griffiths" <[email protected]>:
… So, 2 hours of attempting to convert to Paket and it appears that for some
reason when I move my project over to that, Paket adds two separate
references to System.Net.Http each in Choose/When/ItemGroup sections
conditional on $(TargetFrameworkIdentifier) == '.NETFramework' And
$(TargetFrameworkVersion) == 'v4.7', one with just a single <Reference>
to System.Net.Http and one that shares the group with System.Net,
System.Net.Http.WebRequest, System.Runtime.Serialization and
Microsoft.Rest.ClientRuntime. Presumably this has something to do with me
using a couple of Azure management APIs.
And even after all this I'm getting this warning:
warning MSB3243: No way to resolve conflict between "System.Net.Http,
Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and
"System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Choosing "System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
arbitrarily.
And this despite my paket.dependencies containing this specific version
reference nuget System.Net.Http 4.3.2 (and the paket.references for my F#
project also includes System.Net.Http explicitly).
If in VS's Solution Explorer I delete one of the relevant entries under
the References node for the project, and change the other to require a
specific version, the warning goes away, but then I'm back in much the same
situation as I was with the NuGet workaround: you can make the problem go
away by editing the .fsproj but the next time you update your package
references, the workaround may be overwritten.
So unfortunately Paket doesn't appear to solve my particular instance of
this problem. I don't have a good workaround either with NuGet or Paket.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3415 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNAD3VcUltZoBk-8e3jw1KvzWBVHQks5sZWVugaJpZM4OsW3U>
.
|
Since this is a legacy project system + packages.config issue, with both technologies being deprecated due to intractable problems with their design, this will be closed. I'd encourage any issues of this sort with SDK-style projects to be filed here if they exist: https://github.com/dotnet/project-system (though I doubt they do given how robust it is and how robust packagereference is) |
During F# project build, an assembly reference could be changed to a wrong version of the same assembly from Reference Assemblies.
Repro steps
System.Net.Http
NuGet package version 4.3.2. Note that it containsSystem.Net.Http.dll
with assembly version 4.1.1.1.Expected behavior
The reference to
System.Net.Http
assembly should still point to the correct assembly inpackages\System.Net.Http.4.3.2\lib\net46
.Actual behavior
The reference was changed to point to
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll
, which has assembly version 4.0.0.0 (it's older). This file is also copied to the project output directory.Known workarounds
None.
Related information
Win10 1511, .NET 4.6.1, VS 15.2 (26430.16), Visual F# 4.1
When I do the same with C# console app, it behaves as expected keeping the right assembly.
The text was updated successfully, but these errors were encountered: