为什么重新安装Silverlight会破坏我的导入配置? [英] Why did reinstalling Silverlight break my Import configuration?
问题描述
基于此处的答案:我应该卸载哪个Windows更新(以更新Silverlight或纠正其他问题)?,我卸载/重新安装Silverlight并重新启动。但是,现在,我得到一个编译错误,即:
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:
导入的项目 C:\Program Files(x86)\MSBuild\Microsoft找不到 Silverlight v5.0 Microsoft.Silverlight.CSharp.targets。请确认声明中的路径正确,并且文件在磁盘上。
它指向* .csproj文件中的这一行:
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?
何时我尝试安装Silverlight 4工具(某些人表示这是一种解决方案,例如),我得到安装要求:
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:
必须先安装与Silverlight Tools 4的语言版本匹配的Visual Studio 2010或Visual Web Developer Express 2010或Visual Phone Developer Express 2010,然后才能继续安装Silverlight Tools。 http://go.microsoft.com/fwlink/?LinkId=177432 rel = nofollow noreferrer>> http://go.microsoft.com/fwlink/?LinkId=177432 。
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. "
我做已安装VS 2010(SP1)。而且我什至也安装了用于Web的VS Express(2012)!
I do have VS 2010 (SP1) installed. And I even have VS Express (2012) for Web installed, too!
基于另一个提示,我还安装了Silverlight 4 SDK,但是现在尝试只是打开项目,我得到:在打开Silverlight项目'Bla'之前,需要安装最新的Silverlight Developer运行时。
让我再次安装Silverlight 5。
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...
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
我替换了这一行在csproj文件中:
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.
实际上,只需添加该行(无需替换另一行),项目进行编译,但随后似乎失去了对Razor或类似内容的了解,因为此YSOD失败了:
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
好吧,无论出于何种原因,即将出现的短暂希望只是短暂的海市rage楼-发布先前的更新后立即返回了同样的错误。
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" />
...与此:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" />
...基于此: 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
所有这些都有些奇怪,那就是解决方案可以编译,但是当我运行它时,它抛出一个YSOD,声称是结果编译错误。为什么编译器会成功编译,但是当我去运行该应用程序时,却突然停止了,以一种不自然的尖锐的声音挤出了编译错误?
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?
推荐答案
我遇到了同样的问题,之后就好修复了Visual Studio 2012的安装(未选中开发者工具包Silverlight),一切都很好
I have the same problem, i've just repair my Visual Studio 2012 install (Developer Kit Silverlight was unchecked) after, all good
这篇关于为什么重新安装Silverlight会破坏我的导入配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!