添加引用会添加错误的版本
添加对 VS 2008 的引用时,版本被列为 v1.0.0.0,而它应该是 v1.1.0.0 - 据我所知,绝对没有理由添加错误的版本。
这两个项目都是从头开始编写的,没有其他参考引用我试图添加的程序集,当我在 Windows 中查看该文件时,它具有正确的版本,但不知何故 VS 仍然选择了错误的版本(目标路径是正确的) )。
有谁知道如何让 VS 选择我指向的版本,而不是它认为(毫无理由)的某个旧版本是正确的版本?
我之前问过这个问题,但没有解决问题的答案......
我肯定选择了正确的文件。
When adding a reference to VS 2008, the version is listed as v1.0.0.0 when it should be v1.1.0.0 - as far as I can see there is absolutely no reason why it is adding the wrong version.
Both projects are written from scratch, no other refs reference the assembly I'm trying to add and when I look at the file in windows, it has the correct version, yet somehow VS still picks up the wrong one (the target path is correct).
Does anyone know how to get VS to choose the version that I'm pointing it to, and not some older version it decides (for no reason at all) is the correct one?
I asked this question before, but there were no answers that solved the problem...
I AM DEFINITELY PICKING THE CORRECT FILE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,并发现我设置了参考路径(来自项目属性的“参考”选项卡上的“参考路径”按钮)。这意味着当我添加程序集时,它首先尝试在参考路径中找到它们,而不是我从中选择它们的目录。
我删除了参考路径并能够正确添加文件。
I was having the same issue and discovered that I had a reference path set (from the Reference Paths button on the References tab of the Project properties). This meant that as I added the assemblies, it was trying to find them in the reference path first, rather than the directory I selected them from.
I removed the reference path and was able to add the files correctly.
我通过进入我尝试引用的项目、删除所有引用(例如 system、system.core、system.data 等)并将它们全部添加回来解决了这个问题。这解决了问题。
我无法解释为什么这是解决方案,特别是因为该项目除了默认情况下获得的内容之外没有任何其他参考。
I solved this issue by going into the project I'm trying to reference, REMOVING ALL references (e.g. system, system.core, system.data etc) and adding them all back in. This solved the problem.
I can't explain why this is the solution, especially as this project didn't have any other references in other than what you get by default.
就我而言,问题是由项目文件中的一些
ItemGroup
标记引起的,我用这些标记将外部程序集添加到项目中(以确保版本控制考虑它们)。根据项目组的顺序,是否已添加外部组件的正确版本作为参考。例如,尝试引用版本 1.1.0.0 的外部程序集 Foo.dll,VisualStudio 引用版本 1.0.0.0,因为 Foo.dll 已存在于项目组
在项目组列表中的位置高于
。通过重新排序项目组,我能够引用所需的版本。
In my case the problem was caused by some
ItemGroup
tags within the project file which I used to add the external assemblies to the project (to make sure version control considers them). Depending on the order of the item groups, the correct version of the external assembly has been added as reference or not.E.g. Trying to reference the external assembly Foo.dll at the version 1.1.0.0, VisualStudio referenced the version 1.0.0.0, because Foo.dll has been present in the item group
<None Include="External Assemblies\Bar\Foo.dll" />
being higher in the item group list than<None Include="External Assemblies\Foo\Foo.dll" />
.By reordering the item groups I was able to reference the desired version.