MSBuild command-line error - Silverlight 4 SDK is not installed
Solution 1
I figured this out - there is a setting in MSBuild where you can choose x64 or x86 environment for MSBuild (in the same page where you set MSBuild flags) - set it to x86 and everything will work.
Solution 2
If you have arrived here due to an issue with tfs2010 builds causing the above error (even though you have installed the Silverlight 4 SDK), then in order to achieve the same fix you must edit your Build Process template:
Go to the the "Process" tab, expand the "3.Advanced" section and locate the second from bottom setting ("MSBuild Platform") and set this to X86 which will then instruct the build agent to use the x86 variant of MSBuild.
This solved my problem in conjunction with Paul Betts' answer above.
Solution 3
I've encountered the same problem when running: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
Simply run:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
Solution 4
The start post says that you have to set Target Platform to X86, but that is not the solution for the build server.
In your build configuration file there is an option to set MSBuild Platform to X86. You can find this setting via: Process -> 3.Advanced -> MSBuild Platform (default set to auto)
The underlaying problem is that Silverlight doesn't support 64 bit.
I found this solution, which works for me, on: http://social.msdn.microsoft.com/Forums/en/msbuild/thread/20a742a1-b99c-4638-8590-9a9d6a95fb69
Solution 5
I had this problem on Windows 7 Ultimate 64bit edition when trying to set up the Windows 7 Phone SDK. No combination of SDK/Toolkit installs/repairs was working out for me so I decided to investigate a bit further.
By placing a number of <Message />
build tasks in my Microsoft.Silverlight.Common.targets file, I discovered that I had no registry entry at Software\Microsoft\Silverlight\4.0. This was true for both the 32-bit section and the Wow6432Node section.
So, the outputs of a couple of the build targets that discover where the frameworks are stored were returning blanks, subsequently failing a number of other targets down the line. Specifically, the _FullFrameworkReferenceAssemblyPaths and TargetFrameworkDirectory properties were not being set properly.
Although totally anathema to all recommendations, I circumvented the problem by manually hardcoding the values into the .targets file, like thus:
<PropertyGroup>
<_FullFrameworkReferenceAssemblyPaths>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0</_FullFrameworkReferenceAssemblyPaths>
<TargetFrameworkDirectory>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone</TargetFrameworkDirectory>
</PropertyGroup>
Not something I'm particularly proud of, but needs must if I'm going to make any progress with development. I hope this helps someone else.
Ned
Updated on December 21, 2020Comments
-
Ned over 3 years
My MSBuild command line is as follows:
msbuild e:\code\myProject.csproj /p:Configuration=Debug /p:OutputPath=bin/Debug /p:Platform=x86 /p:PlatformTarget=x86
The project builds fine on my development machine in VS2010 but not with the command above. I am running Win 7 64 - Bit. I'm getting an error that says I don't have the Silverlight 4 SDK installed but I do. I"ve read some posts that you have to set the Platform=x86 but to no avail. Here is the error message in full:
Microsoft (R) Build Engine Version 4.0.30319.1 [Microsoft .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 6/8/2010 4:03:38 PM. Project "E:\code\dashboards\MyProject2010\MyProject2010.Web\MyProject2010 .web.csproj" on node 1 (default targets). GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi les are up-to-date with respect to the input files. CoreCompile: Skipping target "CoreCompile" because all output files are up-to-date with resp ect to the input files. CopyFilesToOutputDirectory: Copying file from "obj\Debug\MyProject.Web.dll" to "bin\Debug\MyProject.Web .dll". MyProject2010.web -> E:\code\dashboards\MyProject2010\MyProject2010.Web \bin\Debug\MyProject.Web.dll Copying file from "obj\Debug\MyProject.Web.pdb" to "bin\Debug\MyProject.Web .pdb". Project "E:\code\dashboards\MyProject2010\MyProject2010.Web\MyProject2010 .web.csproj" (1) is building "E:\code\dashboards\MyProject2010\MyProject20 10.Client\MyProject2010.Client.csproj" (2) on node 1 (GetXapOutputFile target( s)). C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight .Common.targets(104,9): error : The Silverlight 4 SDK is not installed. [E:\cod e\dashboards\MyProject2010\MyProject2010.Client\MyProject2010.Client.cspr oj] Done Building Project "E:\code\dashboards\MyProject2010\MyProject2010.Clie nt\MyProject2010.Client.csproj" (GetXapOutputFile target(s)) -- FAILED. Done Building Project "E:\code\dashboards\MyProject2010\MyProject2010.Web\ MyProject2010.web.csproj" (default targets) -- FAILED. Build FAILED. "E:\code\dashboards\MyProject2010\MyProject2010.Web\MyProject2010.web.csp roj" (default target) (1) -> "E:\code\dashboards\MyProject2010\MyProject2010.Client\MyProject2010.Clie nt.csproj" (GetXapOutputFile target) (2) -> (GetFrameworkPaths target) -> C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlig ht.Common.targets(104,9): error : The Silverlight 4 SDK is not installed. [E:\c ode\dashboards\MyProject2010\MyProject2010.Client\MyProject2010.Client.cs proj] 0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.39
I appreciate anyone's help. Thanks.
-
Simon Brangwin about 13 yearsI'm configuring a new project on our Hudson based continuous integration server. The project has a dependency of the Silverlight 4 SDK and I ran into this error too. We like to keep our builds self-contained with all dependencies checked into source control to allow multiple versions of dependencies without clashes. Installing things on the build server is bad practice. Your investigation work was helpful in diagnosing what the problem was with the Silverlight SDK.
-
Ian Kemp almost 13 yearsWould be nice if (a) you indicated exactly in the Registry the missing key should be, (b) where in the Microsoft.Silverlight.Common.targets file you added the <PropertyGroup> to force the paths.
-
neli over 11 yearsThis works, but I also had to uninstall and reinstall the Silverlight 4 SDK. Very frustrating.
-
gigi over 11 yearsI had this problem with tfs and this fixed it! Thanks
-
jazzy over 9 yearsAlso works with tfs2013 (and also applies to Silverlight 5 projects)