Enabling .NET Framework 4.5 on LightSwitch Server Projects

Enabling .NET Framework 4.5 on LightSwitch Server Projects

Rate This
  • Comments 10

With LightSwitch in Visual Studio 2012 (a.k.a LightSwitch V2) your server projects target the .NET Framework 4.0. This was a conscious decision on the team’s part in order to allow V2 applications to be deployed to the same servers running V1 applications with no fuss. Additionally the LightSwitch runtime takes no dependency on .NET 4.5, just 4.0.

That said, you may want to take advantage of some enhancements in .NET 4.5 on the server side so here’s how you can do that. Keep in mind that this not “officially” supported. The team has not fully tested this scenario so your mileage may vary. In order to change the target framework in LightSwitch, you need to modify the server project file.

Here are the steps:

  1. Close Visual Studio if you have your LightSwitch solution open
  2. Navigate to your solution’s \Server folder
  3. Edit the Server.vbproj (or csproj) file in a text editor like Notepad
  4. Make the following change to the <TargetFrameworkVersion>: <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  5. Save the file & reopen Visual Studio
  6. Compile & verify no errors

Now you will be able to take advantage of the new features in .NET 4.5. For more info see: What's New in the .NET Framework 4.5. Keep in mind you will need to deploy to a server that supports .NET 4.5. See the “Supported Server Operating Systems” section of .NET Framework System Requirements.


Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • Ooooh Beth started "Hacking LightSwitch"...  Moahahahahahehehe he he *cough*  *cough*  (evil laughter during a cold winter).

    Thanks for the hint, and keep rocking LS like only you can! :-)


  • @Jan - LOL! Actually folks have been asking for this in the forums and uservoice so I thought I would show them a workaround. (As you know) LightSwitch project properties do not let you change the framework within the IDE, but in the end, LS project files are just VS project files that have the same settings inside (+ more).

  • @Beth

    Do you have a documentation on this? I couldn't find anything on this.

  • I thought I would show them a workaround

  • Its very good :)

  • Thats fantastic

  • If you develop an extension and require a reference to Microsoft.LightSwitch.Design.Designer, you will need to switch the server to 4.5 since the projects in the extension will require to be built for 4.5.

    Here's the error you get otherwise:

    The primary reference "Microsoft.LightSwitch.Design.Designer, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Microsoft.LightSwitch.Design.Core, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

    You can repro this error with the sample available here:


  • Just encountered a weird issue, even though I updated the TargetFrameworkVersion of my assembly it was still running in a 4.0 Runtime.  I opened web.config and had to add       targetFramework="4.5" to the already existing httpRuntime node there, then all worked well again.

    Keep hacking LS! ;-)

  • @Myself (and others): forget about that node in the web.config unless you want to run into trouble with the built-in SqlMembershipProvider when deploying on Azure...

  • I thought I would show them a workaround

Page 1 of 1 (10 items)