I have an application that I just recently had to upgrade to .NET 4.5 to take advantage of async as well as some other things. It works great in my local dev environment. When I put it on the server (which I just recently installed .NET 4.5), when it gets to an async portion, it errors, throwing a System.MissingMethodException
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__1(System.Object) at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
When I go into the event viewer, it clearly says my windows service is Framework Version: v4.0.30319. My question is how to build it as 4.5? In Visual Studio I've targeted 4.5 and again it works locally. I use TeamCity, in particular MSBuild to build the solution. In my build config file, it is using this as the build path:
<property name="msbuild.path" value="C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe" />
As I understand it there is no 4.5 msBuild. How can I make this service be 4.5 on my server?