visual-studio Silverlight 4:未找到解决 Microsoft.Silverlight.CSharp.targets 的问题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3591369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Silverlight 4: Resolving Microsoft.Silverlight.CSharp.targets was not found?
提问by Brandon
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:
我一直在 Visual Studio 2010 中将一些 Silverlight 3 应用程序升级到 Silverlight 4。我的 Silverlight 3 应用程序在 Visual Studio 中打开正常,但 SL4 应用程序没有,出现以下错误:
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.
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:
我在使用较旧的 VS Silverlight 组件时遇到了问题,最近卸载了大部分 SL 组件,现在在添加/删除程序中我有:
- Microsoft Silverlight
- Microsoft Silverlight 3 SDK
- Microsoft Silverlight 4 Toolkit April 2010
- 微软银光
- 微软 Silverlight 3 SDK
- Microsoft Silverlight 4 工具包 2010 年 4 月
The <import>declaration looks like this for the SL4 project:
<import>SL4 项目的声明如下所示:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
That folder, C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0only has two files in it:
该文件夹中C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0只有两个文件:
Microsoft.Ria.Client.targets
Microsoft.Ria.Client.targets
Microsoft.Ria.Client.VisualStudio.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.
我特别缺少什么 Silverlight 开发组件?我看到了许多不同的选项,从 Silverlight 4 SDK Beta 到 Silverlight 4 的 VS Tools 以及其他一些选项。我不想安装那些会让我回到我之前使用过时组件的情况的东西。
采纳答案by Brandon
回答by Jimmy
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 VS2010package (which will re-install the developer runtime, SDK, a hotfix for VS2010, the Silverlight 4 Tools package, and WCF RIA Services).
Silverlight 4 SDK 中提供了缺少的文件。您可以只安装Silverlight 4 SDK,也可以重新安装整个Silverlight 4 Tools for VS2010包(这将重新安装开发人员运行时、SDK、VS2010 的修补程序、Silverlight 4 工具包和 WCF RIA 服务) .
回答by pat capozzi
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
如果版本 4 位不在该计算机上,则尝试在版本 5 中打开时,您可能会在 Silverlight 版本 4 项目中获得此信息。对我有用的(经过几个小时的尝试)是编辑 csproj 文件并更改 Silverlight 目标版本
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
From 4 to 5
从 4 到 5
回答by nholloway4
This worked well for me...also had to install Silverlight 4 Developer runtime
这对我来说效果很好……还必须安装Silverlight 4 Developer 运行时
回答by Carlos
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
经过多次尝试,对我有用的是: 1. 去添加或删除程序 2. 删除所有安装的 Silverlight 版本(4、5 或即使未指定版本也删除它!) 3. 安装 Silverlight 4 SDK 4. 安装Silverlight 5 for Developers 终于在VS 2010 SP1中开启了项目
回答by Simon_Weaver
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).
当您在服务器上安装新版本的 TFS(或任何与我的 MSBuild 混淆的东西)时,以前工作的安装可能会中断。
My 'targets' files had disappeared from C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0on Server 2012 and reinstalling the tools.
我的“目标”文件已从C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0Server 2012 上消失并重新安装了这些工具。
I believe it may be possible to just copy the targets files from another machine but not 100% sure.
我相信可以只从另一台机器复制目标文件,但不能 100% 确定。

