Wednesday, October 13, 2010

Runtime newer than Currently Loaded

Failure adding Assembly to the cache: The assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

So, today I was building a reporting application with DevExpress Xtrabase Report Suite. (So far great reporting tool). Building it on my machine with VS 2010 and .net Framework 4.0. Everything worked well on my machine. So now comes time to deploy to Development box. Development box is running IIS 6 with .Net Framework 2.0. When I ran the GacUtil tool I received the above error. After some digging I found that I either had to do one of two things. Install .Net Framework 4.0 or recompile my application in .Net Framework 2.0 - 3.5. So since I wasn't using anything specific to 4.0 and I didn't want to spend all day installing software, i opted to just change the properties of my application to build in 3.5. Copied to the dev server and reran the GacUtil and Bajinga... everything worked...

Sunday, October 10, 2010

Point WCF .Svc file to Assembly in the GAC

Separating .SVC file from the WCF code

There are times when you want to package up all your web services into a dll and install in into the GAC. I had to do this on one of my recent Sharepoint/ Silverlight applications. I needed to install the the .SVC file in the Layouts directory of Sharepoint, but I didn't want all the other code there. So i performed the following steps.

  1. Created an Interface for my service and created my service.
  2. Created a .SVC file and stored it into the WebPart project in the 12/Templates/Layouts directory.
  3. Update the .SVC file to point to your Assembly and Service namespace.



Now when you call your service URL http://..../service.svc it will reference the .dll in the GAC