Sharing the goodness…
Beth Massi is a Senior Program Manager on the Visual Studio team at Microsoft and a community champion for .NET developers. Learn more about Beth.
More videos »
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:
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.
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).
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 :)
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=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Microsoft.LightSwitch.Design.Core, Version=18.104.22.168, 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...