At the time of writing (December 2014), the latest version of psake (4.4) defaults to the .NET framework 4 if you don’t explicitly set a framework at the top of your build scripts.
Due to the the peculiar way Microsoft setup MSBuild for .net 4.5.x, this means that psake fails with the following error if you try to build a solution that targets 4.5.1 or 4.5.2.
1 2 3 4 |
"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\ WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. |
You have to explicitly set the ‘Framework’ variable to 4.5.1 at the top of the file to make psake use the correct version of msbuild.
1 2 3 4 5 6 |
Framework 4.5.1 properties { $solutionName = "MySolution" $base_dir = "C:\Projects\ProjectFolder", etc, etc |
Note that using the value 4.5.1 also works for projects that target 4.5.2 (the value 4.5.2 is not recognised by psake).