Ryan
Ryan

Reputation: 3171

How do I know what version of the .net framework I need to build for

I have a bunch of solutions in C# that I've been handed. There is production code on the server, and I have a version of it on a local dev machine. I make a code change, and build the dlls. When I try to copy the dlls to the server, it gives me errors like:

"Could not load file or assembly 'myfile.dll' or one of its dependencies. 
This assembly is built by a runtime newer than the currently loaded runtime 
and cannot be loaded."

One of the issues is that the projects that I use for building ORM, data, and business logic are not on the server, but are on my local, and I can use them to build dlls, but it isn't helpful when I can't tell what the server is using either. Where do you find out what versions it runs and how to build to match? I know this is my own ignorance in not knowing how the .net framework works, the different versions, how to build for the right one (32-bit vs 64-bit a concern too?) and get things to work. I have looked around a bit, but no where seems to explain this.

Upvotes: 0

Views: 542

Answers (2)

Krzysztof Cieslinski
Krzysztof Cieslinski

Reputation: 924

To change the target framework of your project in vs2k10: Open project properties -> Application tab -> Target framework(its combobox with available versions)

To check/change the framework version on your server(it is for IIS 7.0 version):

  1. Open IIS manager.
  2. Click the “Application Pools” node.
  3. Find the corresponding application pool that your web site/virtual directory use(by default there is a “DefaultAppPool” application pool).
  4. Right click the application pool, and then select “Advanced Settings”
  5. There should be “.NET Framework Version”

Upvotes: 0

Andre Calil
Andre Calil

Reputation: 7692

32 or 64 bits should not bother you. To find the framework version, you must look for the website or virtual directory at IIS.

I don't have a Windows Server here, but it's something like this:

  1. Open IIS Management tool
  2. Find your website or virtual directory, right click and go to properties
  3. There should be a tab named .Net (or something like it)
  4. At this tab, there is a combo with the available runtime versions binded to IIS. The current is the one you're using.

These steps are for IIS 6. For IIS 7 it's mostly the same, but they don't call it "properties" window, it's "Advanced something".

I'm sorry for not having the proper details, but you'll be able to find it.

Upvotes: 1

Related Questions