VS2010 项目 -- 未解析的引用(其中缺少 HintPath 属性)

发布于 2024-11-08 22:55:25 字数 1097 浏览 3 评论 0原文

我们正在将构建计算机更换为新的计算机,同时更换为 Visual Studio 2010。我们有大约 500 个不同的小组件,每个组件都有自己的 csproj 文件,它们都具有对“\Framework\bin\”目录中程序集的引用。

获得完整的源代码并开始编译我们的项目后,我们遇到了一个问题:许多引用无法解析,但不是全部,并且不同项目上的引用并不总是相同。该问题似乎与 csproj 文件的 HintPath 属性有关。

具体来说,下面是一个可以解析的引用示例:

<Reference Include="AIS.Common, Version=8.1.0.1, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\..\Framework\Bin\AIS.Common.dll</HintPath>
</Reference>

这是一个不能解析的引用示例:

<Reference Include="AIS.ControlLib, Version=9.1.0.1, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
</Reference>

奇怪的是,Visual Studio 中两个引用的属性完全相同(当然,他们的姓名和身份除外)。所以看起来 HintPath 是自动生成的,但为什么只在某些引用上生成?

我们怀疑该问题可能是由于使用不同版本的 Visual Studio 引起的(在 500 多个项目中,有些在 VS2005 中,有些在 VS2008 中,有些仍在 VS2010 中),但我们无法将行为范围缩小到合乎逻辑的范围。

有没有什么方法可以编译我们的项目,而不必手动重新附加未解析的引用?

We are in the process of changing our build computer to a new one and at the same time to Visual Studio 2010. We have around 500 different small components, each one an own csproj file, all of them having references to assemblies in a "\Framework\bin\" directory.

After getting the whole source code and starting compiling our projects, we've ran into a problem: many references cannot be resolved, but not all of them, and not always the same references on different projects. The problem seems to be linked to the HintPath attribute of the csproj files.

Specifically, here's an example for a reference that can be resolved:

<Reference Include="AIS.Common, Version=8.1.0.1, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\..\Framework\Bin\AIS.Common.dll</HintPath>
</Reference>

And here's one that can't:

<Reference Include="AIS.ControlLib, Version=9.1.0.1, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
</Reference>

Strangely, the properties of the two references in Visual Studio are exactly the same (except for their Name and Identities, of course). So it seems that HintPath is auto-generated, but why only on some references?

We suspect the problem could arise from using different version of Visual Studio (of the 500+ projects, some are in VS2005, others in VS2008, others still in VS2010), but we could not narrow the behaviour down to something logical.

Is there any way to compile our projects without having to resort to manually reattach the unresolved references?

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

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

发布评论

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

评论(2

檐上三寸雪 2024-11-15 22:55:25

郑重声明,将以下键添加到注册表后,VS 可以解析我们的引用:

键:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\ProjectName
价值:
“D:\AIS\Projects\Framework\Bin”

在注册表中播放很少感觉像是正确的做法,但在我们的情况下,它解决了问题。不过,我仍然会接受一个能够阐明整个事情的答案。

For the record, after adding the following key to the registry, VS could resolve our references:

Key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\ProjectName
Value:
"D:\AIS\Projects\Framework\Bin"

Playing in the registry rarely feels like the right thing to do, but in our situation, it solved the issue. I would still accept an answer that would shine light on the whole thing, though.

蓝天 2024-11-15 22:55:25

就我而言,问题是我的项目指定的目标 .NET 框架版本比引用的项目更低

In my case the problem was, that my project has lower target .NET framework version specified, than referenced projects.

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