We've recently installed .NET 4.5 onto our continuous integration build server so that it can support new projects that utilize features of .NET 4.5. This build server is also used to build and deploy older projects, as well, some of which target .NET 4.0.
Projects that target .NET 4.0 being built on this server, then deployed to a target server that has only .NET 4.0 installed are now failing with the following error:
Method not found: 'Int32 System.Environment.get_CurrentManagedThreadId()'.
Environment.CurrentManagedThreadId is a new property of .NET Framework 4.5, so it makes sense that a server running 4.0 can't find it. However, we are targeting .NET 4.0 at build time, so in theory we shouldn't need to have 4.5 installed on the production server.
To sum up:
- Project targets 4.0
- Build server has 4.5 installed
- The server on which the project is then deployed has only .NET 4.0
- Project fails at runtime with error
Method not found: 'Int32 System.Environment.get_CurrentManagedThreadId()'.
What gives? Is it possible to successfully run .NET 4.0 dlls on a server with only .NET 4.0 installed when the dlls are built by a server with .NET 4.5?