0

Problem: I want to deploy modified code into web server. web server is having IIS version set to V2.0. and now I have developed and published code on my local machine with version 4.0. (there is App_code.dll as part of all dll files).

Now whenever I am deploying all files along with App_code.dll I am getting following error:" Could not load file or assembly 'App_Code' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded"

1) My question is how do I build App_code.dll in older version. 2) I tried changing target framework to V2.0 while publishing but then its not working because AJAX functions from other dll are not compiling..

can anyone please suggest what to do to run the site..

Help is appreciated.

Thanks

user1802212
  • 53
  • 1
  • 2
  • 10
  • I'm going to ask the obvious question but, can you change the IIS application to run in 4.0? – Always Learning Apr 03 '18 at 05:35
  • @AlwaysLearning: Its working on locally but even on UAT server .net version 4.6 is installed and I tried changing to latest version still its giving some errors. is there any other solution for this issues? – user1802212 Apr 03 '18 at 06:20
  • What version of .net is the IIS application pool for your application running in on UAT? 2.0 or 4.0? – Always Learning Apr 03 '18 at 13:37
  • @AlwaysLearning: its V2.0.There is .net framework 4.6 in installed in UAT and I tried changing IIS to 4.0 but getting HTTP service **** something like that error. The issue is only with App_code.dll which is being built in V4.0 on local machine. I want to build it in v2.0 which I cant due to other ajax related errors. – user1802212 Apr 04 '18 at 01:28

2 Answers2

0

Sorry about the answers I've given... But try this...

Try adding <codeBase> elements to the application config file to specify the exact location of each dll, and the version of .Net it requires. Apparently this works because <codebase> is checked BEFORE the probing heuristics kick in each time an assembly needs to be loaded.

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="sharedlibA" culture="neutral" publicKeyToken="..." />
      <codeBase version="1.0.0.0" href="bin\sharedlibA.dll" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="sharedlibB" culture="neutral" publicKeyToken="..." />
      <codeBase version="1.0.0.0" href="bin\sharedlibB.dll" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

If that doesn't work try this.

Fandango68
  • 4,461
  • 4
  • 39
  • 74
0

Late answer but, I'm writing this for future viewers. I had same error after publish the application to the Server. I figure it out doing like this.

While publish there is configuration in Setting.

enter image description here

In publish section there is option called

Precompile during publishing

you have to check the checkbox and save then Publish. This will takes your code files .vb/.cs and converts them into a compiled DLL files. In my case it was unchecked.

Shakir Ahamed
  • 1,290
  • 3
  • 16
  • 39