Works just fine, but changing to this, which we git when we upgraded: <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly>
Gives a runtime error.
[BadImageFormatException: Det går inte att läsa in filen eller sammansättningen System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a eller ett av dess beroenden. Referenssammansättningar ska inte läsas in för körning. De kan endast läsas in i inläsningskontexten Reflection-only. (Undantag från HRESULT: 0x80131058)]
It guess it is ok to change but when we build the project unsing TeamCity I get this:
The type 'HttpResponseMessage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I have tried to Update-Package -ReInstall but that did not work, I still need to refer to 4.0.0.0 to get the site to startup.
So it is expecting package version 4.1.1.3 here.
Erase the reference from here and remove the reference also and install the one needed for the solution to run.
And look again what reference version exists after that in same file.
I have added the Nuget package to all related project but no matter how I do the reference is always pointing to this:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Net.Http.dll
And that dll is different than …\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll
I don’t get why and I can’t uninstall the System.Net.Http package because Litium is depending on it.
Somehow Visual Studio (or the nuget package ssytem) is adding the System.Runtime.InteropServices.RuntimeInformation assembly into the project-references, please remove that and remove the actual System.Runtime.InteropServices.RuntimeInformation.dll from the bin-folder. Try to rebuild the application.
Ensure that you have correct package versions in all projects, this pointing to that some project have a reference to the old version, can be a reference that is created without adding the nuget package.