Pergunta

I get this error message while compiling:

Assembly 'MyFramework [...]' uses 'System.Web.Extensions, Version=3.5.0.0 [...]' which has a higher version than referenced assembly 'System.Web.Extensions, Version=1.0.61025.0 [...]'

MyProject refers both System.Web.Extensions 1.0 AND project 'MyFramework', the latter in turn refers web extension 3.5. Both references are Copy local = false, Specific version = true.

The error occurs in MyProject (not in MyFramework). What is wrong here?

I understand that two versions of the same assembly cannot coexsist on the same location, this is why copy local is false.

(I know the setup is lame, it's a huge legacy application, can't just refactor anything.)

UPDATE: there must be something with my project. I created a sample project (for 2.0, referring web extensions 1.0) that uses another sample project(fwk 3.5, web extensions 3.5) an compiles all right. (The way I expected.) So I basically modelled the situation and could not reproduce the problem. The question has changed to:

What may cause the above behaviour? Technically, is there anything wrong in refering two versions of the same strong-named assembly?

UPDATE 2: see accepted answer comments for the root cause. ("Exposed types.") Still need to find the way to solve it.

Foi útil?

Solução

You have to use extern alias to reference two distinct versions of the same assembly.

Outras dicas

You need to add a <bindingRedirect> in App.config.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top