参考不能因为相同的名字被添加 [英] Reference could not be added because of same name

查看:173
本文介绍了参考不能因为相同的名字被添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于更新到2013 VS我有,我不能一提到2个项目具有相同的名称添加的行为。我做了以下内容:

Since the update to VS 2013 I have the behaviour that I cannot add a reference to 2 projects with the same name. I did the following:


  1. 新增3解决方案文件夹A,B和C

  2. 增加了一个。类型类库核心项目A和b文件夹。

  3. 添加型ConsoleApplication的项目目录C。

所生成的结构是这样的:

The resulting structure looks like this:

Solution
 + A
   + Core
 + B
   + Core
 + C
   + ConsoleApp

在一个以下的项目属性中输入:

In the project properties of A the following is entered:


  • 大会名称:A.Core

  • 默认命名空间:A.Core

和b中:


  • 大会名称:B.Core

  • 默认命名空间:B.Core

在我加入C.ConsoleApp到A.Core参考,我试着参考B.Core到控制台我得到的错误:

After I added a reference to A.Core in C.ConsoleApp and I try to reference to B.Core to the console I get the error:

为核心(B.Core)'的引用无法添加。到组件核心的引用已经存在的项目。

A reference to 'Core (B.Core)' could not be added. A reference to the component 'Core' already exists in the project.

溶液用VS 2012中创建和显示自升级这种行为。我有什么到控制台内部设置

The solution was created with VS 2012 and shows this behavior since upgrade. What do I have to setup inside the console?

编辑:我发表了关于 YouTube的来解释这个问题,放在一个bug在的微软支持。我仍然认为,这是一个错误。

I published a screencast on Youtube to explain the problem and placed a bug at Microsoft-Support. I still think, this is a bug.

推荐答案

的问题是,参考名称将采用项目名称。它仍然引用了适当的名称(或A.Core.dll B.Core.dll)的DLL,但参考使用项目名称里VS:

The issue is that the reference name takes on the project name. It's still referencing the DLL by the appropriate name (A.Core.dll or B.Core.dll), but the reference uses the project name inside VS:

如果你看一下项目文件加入A.Core参考后,你会看到这一点:

If you look at the project file after adding a reference to A.Core, you'll see this:

<ProjectReference Include="..\ClassLibrary1\Core.csproj">
  <Project>{16c42795-f703-4673-98e4-98758c09f9e0}</Project>
  <Name>Core</Name>
</ProjectReference>

更改名称值A.Core,你会畅通。 (B.Core仍将显示为核心,直到您编辑它。)

Change the Name value to A.Core and you'll be unblocked. (B.Core will still show up as "Core" until you edit it as well.)

这篇关于参考不能因为相同的名字被添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆