50

I've been upgrading some Silverlight 3 apps to Silverlight 4 in Visual Studio 2010. My Silverlight 3 apps open fine in Visual Studio, but SL4 apps don't, with the following error:

C:\Path\To\MyProject.csproj : error : Unable to read the project file 'XNTVOD.AdminClient.csproj'. C:\Path\To\MyProject.csproj(593,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

I had a problem with older VS Silverlight components and recently uninstalled most of the SL components, and right now in Add/Remove programs I have:

  1. Microsoft Silverlight
  2. Microsoft Silverlight 3 SDK
  3. Microsoft Silverlight 4 Toolkit April 2010

The <import> declaration looks like this for the SL4 project:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />

That folder, C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0 only has two files in it:

Microsoft.Ria.Client.targets

Microsoft.Ria.Client.VisualStudio.targets

What Silverlight development component am I missing in particular? I see a bunch of different options, from Silverlight 4 SDK Beta to VS Tools for Silverlight 4 and a bunch of others. I don't want to install stuff that will get me right back to the situation I had before this one with outdated components.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Brandon
  • 13,956
  • 16
  • 72
  • 114
  • I'm having a similar problem. My error is telling me I'm missing the proper file in "\Silverlight\v3.0" even though I have v4.0 installed. I also have the proper Silverlight 4.0 file, but VS doesn't seem to see it. – Jason L Oct 19 '12 at 15:31

6 Answers6

44

Looks like this is the missing piece...

Silverlight 4 Tools for Visual Studio 2010

Chris Grant
  • 2,463
  • 23
  • 27
Brandon
  • 13,956
  • 16
  • 72
  • 114
  • 3
    What about Visual Studio 2015 ? Is there a distinct link per visual studio version - or is the version indifferent ? – Veverke Aug 22 '16 at 12:31
18

The file that's missing ships in the Silverlight 4 SDK. You can either install just the Silverlight 4 SDK, or re-install the entire Silverlight 4 Tools for VS2010 package (which will re-install the developer runtime, SDK, a hotfix for VS2010, the Silverlight 4 Tools package, and WCF RIA Services).

porges
  • 30,133
  • 4
  • 83
  • 114
Jimmy
  • 27,142
  • 5
  • 87
  • 100
  • 2
    In case of VS SP1, you can't reistall the SL 4 Tools fo VS2010. Just (re)install the SDK. – artur02 Sep 30 '11 at 12:46
  • Installing the Silverlight 4 SDK was what I needed, because I needed it available while not having VS2010 but 2013 – fnicollet Aug 06 '14 at 21:00
11

You may get this with Silverlight version 4 projects when trying to open in version 5 if version 4 bits are not on that machine. What has worked for me (after several hours of trying everything) is to edit the csproj file and change the silverlight target version

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

From 4 to 5

BenMorel
  • 34,448
  • 50
  • 182
  • 322
pat capozzi
  • 1,412
  • 1
  • 20
  • 16
5

This worked well for me...also had to install Silverlight 4 Developer runtime

nholloway4
  • 246
  • 1
  • 4
  • 13
4

Afer many tries, what worked for me was: 1. go to add or remove programms 2. remove all silverlight versions installed (4, 5 or even if version is not specified remove it too!) 3. install Silverlight 4 SDK 4. install Silverlight 5 for developers Finally opened the project in VS 2010 SP1

Carlos
  • 41
  • 1
0

A previously working installation can break when you install a new version of TFS on the server (or whatever it was that messed with my MSBuild).

My 'targets' files had disappeared from C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0 on Server 2012 and reinstalling the tools.

I believe it may be possible to just copy the targets files from another machine but not 100% sure.

Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689