Skip to content
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

binding redirects should be created when two projects depends on each others but are referencing different assemblies #1621

Closed
smoothdeveloper opened this issue Apr 18, 2016 · 5 comments

Comments

@smoothdeveloper
Copy link
Contributor

Description

I faced situation where NUnit test projects targetting different framework but referencing one another would throw runtime error in test runner.

This is because assembly version is different between each framework for a given NUnit release.

Repro steps

paket.dependencies

redirects: on
source https://www.nuget.org/api/v2

nuget NUnit = 3.0.1

have projectA depend on NUnit and compiled for .NET 4.0

have projectB depend on NUnit and projectA and compiled for .NET 4.5, projectB needs to call a member from projectA which depends on NUnit.

I'm adding a test in integrationtests.

Expected behavior

My assumption is that paket install could detect this situation and generate correct binding redirect, but I'm unsure if it should go to that extent (changing the target framework again might break until next paket install).

Actual behavior

This is what I get running the test from projectB

System.IO.FileLoadException : Could not load file or assembly 'nunit.framework, Version=3.0.5813.39032, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Known workarounds

Write the redirect manually.

Related information

  • Windows 7 64bit
  • branch: master
  • .NET 4 & 4.5
smoothdeveloper added a commit to smoothdeveloper/Paket that referenced this issue Apr 18, 2016
If possible, generating a binding redirect for this case would avoid a runtime error while running tests of projectB
@forki
Copy link
Member

forki commented Apr 19, 2016

integration test in #1622

/cc @isaacabraham @mrinaldi
any ideas?

@isaacabraham
Copy link
Contributor

Sorry - can you provide the expected dependency redirects and what you actually get? Cheers

@smoothdeveloper
Copy link
Contributor Author

smoothdeveloper commented Apr 19, 2016

@isaacabraham the test has the expected redirect in the assert. Right now, no redirection is being written.

Expects to redirect all nunit.framework versions in this project to 3.0.5813.39031 (the version for .NET 4.5)

@smoothdeveloper
Copy link
Contributor Author

I'm facing the same with another dependency, it fails to compile in this case somehow.

It seems common practice to have different file versions for different framework which is somehow annoying.

Apparently, pinning the framework in paket.dependencies for that particular dependency doesn't seem to make the project point on correct assembly, I'll see if I can make another integration test for this.

In this case, the workaround is to remove the dependency and add it manually.

@forki
Copy link
Member

forki commented Apr 22, 2016

@mrinaldi sent a PR in #1634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants