Thursday, 15 March 2012

c# - The new DLL Hell; wrong assembly version being bound -



c# - The new DLL Hell; wrong assembly version being bound -

i'm running vs2013 update 1 nuget v 2.8.50313.46

you can skip this of import bit, , recent updates, , come reference.

i have vs solution, simplified representation of it.

-- solution - base of operations (class library) packages: no packages installed. references: scheme system.configuration system.core system.runtime.caching system.web - appbase (class library) packages: no packages installed. references: scheme system.core system.web.http base of operations - client (console application) packages: entityframework v6.1.0 htmlagilitypack v1.4.6 references: entityframework entityframework.sqlserver htmlagilitypack scheme system.core appbase base of operations - server (web application) packages: htmlagilitypack v1.4.6 microsoft.aspnet.webapi v5.1.2 microsoft.aspnet.webapi.client v5.1.2 (dependent on > newtonsoft.json v4.5.0) microsoft.aspnet.webapi.web... v5.1.2 newtonsoft.json v6.0.3 references: htmlagilitypack newtonsoft.json scheme system.net.http system.net.http.formatting system.web system.web.http system.web.httphost appbase base of operations

the code within server needs newtonsoft.json v6.0.3 function.

when rebuild , run works fine, expected.

i subsequently build appbase, without building server. appbase dependent on base. binaries appbase , base "up-to-date", expected.

however,

this of import bit,

the building of appbase causes newtonsoft.json.dll in "server\bin" folder substituted before 4.5 version.

when create request server, "500 intrernal server error" returned due binding error caused wrong newtonsoft.json dll version.

why building assembly effect non dependent assembly?

has else experienced this?

what best way resolve problem?

edit 19/06/2014

i made new solution file, @ first thought had resolved problem. problem had transferred system.net.http.formatting.dll :-s

if edit appbase not reference system.web.http effect goes away. maybe mvc stuff in programme files? ...

edit 20/06/2014

i've posted community wiki answer details how i've worked around problem. thought might find useful. however, workaround doesn't explain mechanism effecting server when build appbase , base. sound bug, seems wrong?

the reference system.web.http in appbase pointing to

c:\program files(x86)\microsoft asp.net\asp.net mvc 4\assemblies\system.web.http.dll

i added latest

microsoft.aspnet.wepapi.core 5.1.2

package appbase used in server. pulled in dependency packages,

microsoft.aspnet.webapi.client 5.1.2 newtonsoft.json 6.0.3 (the version in bundle source)

the system.web.http reference in appbase points to,

mysolutionfolder\packages\microsoft.aspnet.webapi.core.5.1.2\lib\net45\system.web.http.dll

when build appbase now, wepapi dlls in server no longer altered legacy versions.

incidentally,

this bundle alter adds multiple (a|a)pp.config files within solution's projects, binding redirects latest version of newtonsoft.json.

note

i view work around albeit, 1 i'm glad find.

the code in appbase not need latest system.web.http.dll. still don't know why building appbase should effect server, bug?

marking troublesome dlls read-only did not protect them. changing security rights did, no error logged during build of appbase, diagnostic build logging.

c# visual-studio-2013 json.net nuget

No comments:

Post a Comment