I am attempting to run a build programmatically and when building any Silverlight content get the message: "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets(104,9): error : The Silverlight 4 SDK is not installed.", but I have installed the Silverlight 4 SDK (many times).

I attempt to do the build basically like this:

var logger = new FileLogger();
logger.Parameters = @"logfile=" + buildLogFileName;

var projectToBuild = Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.LoadProject(buildFile.FullName);
                projectToBuild.SetProperty("Configuration", "Release");
var successfulBuild = projectToBuild.Build(logger);

I have tried a number of workarounds and suggestions, but everything just sort of leads to other error messages. It seems like the best course would be to get it to understand that the Silverlight 4 SDK IS installed, but not sure how to do that? Or if there is something I'm missing here.

  • I don't have Silverlight SDK installed at the moment. Try to take a look on what exactly has been checked in C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets(104,9) – Sergio Rykov Apr 14 '11 at 13:07
  • What is the environment in which the code above is being executed? I'm assuming the build works from a VS command line, so what is different? – Brian Kretzler Apr 14 '11 at 14:26
  • In the .targets file it looks like there is a $(TargetFrameworkSDKDirectory) but when we check that (via build messages) it is blank, not sure where it gets that initial value from? Is there a silverlight target that needs to be set or similar? – ChrisHDog Apr 15 '11 at 2:25
  • The code above is being executed on a developer machine (windows 7 x64 with VS2010), the VS2010 build does work, but the code does not (though the code above does work for non-silverlight projects). – ChrisHDog Apr 15 '11 at 2:26

If your build server has a 64-bit OS, this post is quite useful. It tells of forcing the build to 32-bit for Silverlight.

  • great post and that is basically the issue i'm seeing, but i'm not using a build server so there is no team explorer to open/change – ChrisHDog May 22 '12 at 7:42
  • So maybe this question: stackoverflow.com/questions/1074654/… could be useful to you. – Timores May 22 '12 at 13:18

In your .csproj-File, replace the tag WindowsPhone71 by WindowsPhone


If setting build to X86 and reinstalling Silverlight SDK 4 was not helpful: If you are using VS2013 on the build server, check if Windows Phone SDK is installed. I had to go run VS2013 installer, click change button and install windows phone sdk.

Or try to install windows phone sdk to be able to build windows phone solutions.


I was getting the same error, changed form AnpCPU|Relase to X86|Release

folow the suggestion on http://joychua97.blogspot.com/2012/02/fixing-silverlight-4-sdk-is-not.html

C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets (104): The Silverlight 4 SDK is not installed.

Looking around, they said that "Silverlight projects cannot be built by 64-bit MSBuild."

To resolve this: 1) Edit your Build Definition, and go to the Process tab 2) Expand the "3. Advanced" section and set the "MSBuild Platform" value to "x86" 3) Save the Build Definition.

  • The worst case is that when you have multiple project in .sln and want to build others in 64 bit. – Janusz Nowak Aug 30 '15 at 21:25

Your Answer

