11

Based on the answer here: Which, if any, recent Windows updates should I uninstall to revivify Silverlight or rectify other problems?, I uninstalled / reinstalled Silverlight and rebooted. Now, though, I get a compilation error, namely:

"The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk."

It points to this line in a *.csproj file:

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

I don't understand what this is doing, exactly; if it's something grokkable from afar, what do I need to do to solve this dilemma?

UPDATE

When I try to install the Silverlight 4 Tools (as some indicate is a/the solution, such as at Silverlight 4: Resolving Microsoft.Silverlight.CSharp.targets was not found?), I get, "Installation Requirements:

Visual Studio 2010 or Visual Web Developer Express 2010 or Visual Phone Developer Express 2010 that matches the language version of Silverlight Tools 4 must be installed before installation of Silverlight Tools can continue. Silverlight Tools is available in other languages at http://go.microsoft.com/fwlink/?LinkId=177432. "

I do have VS 2010 (SP1) installed. And I even have VS Express (2012) for Web installed, too!

UPDATE 2

Based on another tip, I also installed the Silverlight 4 SDK, but on trying to just open the project now, I get, "You need to install the latest Silverlight Developer runtime before opening Silverlight project 'Bla'." It had me install Silverlight 5 (again).

I did so, but I rebooted, and...still get that same err msg...

UPDATE 3

Based on a clue I got here: http://connect.microsoft.com/VisualStudio/feedback/details/573750/the-imported-project-path-microsoft-webapplication-targets-was-not-found

I replaced this line in the csproj file:

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

...with this one:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

...and I get further along than before, but I don't know if that last change was the necessary alteration, or if all of the steps enumerated above are necessary. Other than the Shadow, it's likely that nobody knows.

UPDATE 4

Actually, simply adding that line (no need to replace the other), the project compiles, but then seems to lose its knowledge of Razor or something, as it fails with this YSOD:

Server Error in '/TLDReporter' Application.
Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0103: The name 'Helprs' does not exist in the current context

Source Error:


Line 493:                <div class="inner" style="width: 300px;">
Line 494:                    <p id="portal_breadcrumbs" class="breadcrumb">
Line 495:                        @Helprs.Sitemap(ConfigurationManager.AppSettings["ApplicationHome"])
Line 496:                    </p>
Line 497:                </div>

Source File: c:\Project\. . .\Shared\_Layout.cshtml    Line: 495

UPDATE 5

Okay, for whatever reason that brief glimpse of hope that dawned on the horizon was just a fleeting mirage - the same err returned immediately after having posted the previous update.

However, once I replaced this:

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

...with this:

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

...based on this: http://msdn.microsoft.com/en-us/library/ff921165(v=PandP.20).aspx

...I get further, but again just back to this compilation point:

@Helprs.Sitemap(ConfigurationManager.AppSettings["ApplicationHome"])

UPDATE 6

Something quite bizarre about all of this is that the solution compiles, but when I run it, it throws up a YSOD that claims to be the results of a compilation error. Why would the compiler successfully compile, but then when I go to run the app, come to a screeching halt, squealing out "Compilation Error" in an unnaturally shrill tone?

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    I encountered the same issue after upgrading to VS2013 but havent found any solution. I posted it in http://stackoverflow.com/questions/20054544/how-to-open-silverlight-project-after-upgrading-to-vs-express-2013-for-web – Andrus Nov 18 '13 at 19:54
  • 1
    +100 Thank you very much for this very detailed post. Your update 5 fixed my Silverlight issue after updating VS 2015. I wish I could upvote this post again and again. Kudos to you! – Annie Lagang Jul 04 '16 at 05:18
  • @AnneLagang: I'm glad it helped! – B. Clay Shannon-B. Crow Raven Jul 05 '16 at 18:01

3 Answers3

10

Installing "Microsoft® Silverlight® 5 SDK" and x64 runtime worked for me.

SDK https://www.microsoft.com/en-us/download/details.aspx?id=28359

x64 https://www.microsoft.com/en-my/download/details.aspx?id=28358

pawciu
  • 855
  • 9
  • 15
  • I know this is very old but I'm wondering if this same content is available via the Nuget package now: https://www.nuget.org/packages/Unofficial.SilverlightToolkit-All/ I'm not a .NET programmer so I don't know if this is actually the SDK too. – jrk Apr 13 '16 at 16:52
  • Checking both items are installed as well as the **Microsoft® Silverlight® 5 Tools for Visual Studio** as mentioned by @msgeek fixed it for me. – Bahamut Dec 01 '16 at 03:04
5

I have the same problem, i've just repair my Visual Studio 2012 install (Developer Kit Silverlight was unchecked) after, all good

Jacky Lormoz
  • 165
  • 2
  • 11
  • I went with `Modify` instead of `Repair`, and afterwards `VS` prompted me to install `Silverlight Developer` (gives the download link as well). Only then it worked for me. – Veverke Aug 22 '16 at 12:53
2

Download and install Microsoft® Silverlight® 5 Tools for Visual Studio based on your version, that solved my problem VS2010 link - http://www.microsoft.com/en-us/download/details.aspx?id=28358

msgeek
  • 21
  • 1
  • What worked for me was to install the equivalent for VS2013: http://www.microsoft.com/en-us/download/details.aspx?id=28359 – Jacek Gorgoń Nov 19 '15 at 23:06