我是唯一一个收到“当前目标框架中无法使用程序集”的人吗?

发布于 2024-11-29 20:21:07 字数 685 浏览 3 评论 0原文

在添加测试项目后,我在使用 Visual Studio 2010 和任何报告此错误的框架版本时遇到了持续存在的问题:

“程序集在当前目标框架中不可用”

到目前为止,我仅在两个程序集上发生过这种情况,并且始终一致:

  • 系统.ServiceProcess
  • 系统.配置.安装

问题是项目文件没有识别这些引用的特定框架版本,在属性中显示版本 0.0.0.0。我可以通过手动更改项目文件以包含True来解决此问题在参考元素中。

这是一个问题,因为我无法继承或实现这些有问题的程序集的 Mole 类型。问题是 Pex 和 Moles 生成了自己的项目文件,这些文件在构建过程中也被破坏了。没有机会手动修复这些问题,而且我认为必须使用 ICorProfilerCallback.JITCompilationFinished 构建解决方法来编译任何内容是愚蠢的。

那么,还有其他人有这个问题吗?我已经重新安装了VS2010。我没有看到任何解决办法。

我肯定已经研究过这个问题,并且一整年都在努力解决这个问题。我对此感到相当恼火,并认为有些事情根本出了问题,或者我不明白这是预期的行为(我无法想象为什么......)。

I have had a persistent problem with Visual Studio 2010 and any framework version reporting this error, after adding a test project:

"Assembly Not Available in the Currently Targeted Framework"

So far, I have had this happen with only two assemblies, and always consistently:

  • System.ServiceProcess
  • System.Configuration.Install

The problem is that the project file does not identify a specific framework version for these references, showing version 0.0.0.0 in the properties. I can work around this by manually altering the project file to include <SpecificVersion>True</SpecificVersion> in the reference element.

This is a problem, because I am unable to Mole types that inherit or implement these problematic assemblies. The issue is that Pex and Moles generate their own project files, which are also broken, during the build process. There is no opportunity to manually fix these, and I think it's just stupid to have to build a workaround using ICorProfilerCallback.JITCompilationFinished to get anything to compile.

So, does anyone else have this issue? I have already re-installed VS2010. I don't see any fix for this.

I have most certainly researched this, and have been working around it all year. I'm getting rather annoyed by this, and think something has simply gone wrong or I don't understand that this is intended behavior (I can't imagine why...).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黯然#的苍凉 2024-12-06 20:21:07

进入项目属性并将目标框架更改为 .NET Framework 4。我猜您使用的项目类型默认为 .NET Framework 4 Client Profile。 (例如控制台应用程序)

Go into project properties and change the Target Framework to .NET Framework 4. I'm guessing you're using a project type whose default is .NET Framework 4 Client Profile. (like console app, for example)

只怪假的太真实 2024-12-06 20:21:07

我遇到了完全相同的问题,Visual Studio 突然无法引用这些程序集:
系统服务流程
System.Configuration.Install

解决此问题的唯一方法是重新安装 Visual Studio 2010,并放弃使用 Moles 的所有希望,直到问题得到解决。

I'm having exactly the same problem with Visual Studio suddenly being unable to reference these assemblies:
System.ServiceProcess
System.Configuration.Install

The only way to fix it is to re-install Visual Studio 2010 and abandon all hope of using Moles until it's fixed.

你的背包 2024-12-06 20:21:07

Visual Studio 2010 在 .csproj 文件中生成了以下参考元素:

<Reference Include="System.Configuration.Install" />
<Reference Include="System.ServiceProcess" />

要纠正该问题,必须将 XML 修改为:

<Reference Include="System.Configuration.Install">
    <SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="System.ServiceProcess">
    <SpecificVersion>True</SpecificVersion>
</Reference>

Visual Studio 2010 generated the following reference elements, in the .csproj files:

<Reference Include="System.Configuration.Install" />
<Reference Include="System.ServiceProcess" />

To correct the problem, the XML must be modified, to:

<Reference Include="System.Configuration.Install">
    <SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="System.ServiceProcess">
    <SpecificVersion>True</SpecificVersion>
</Reference>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文