如何设置“特定版本” Visual Studio 中项目引用的属性

发布于 2024-07-22 06:56:10 字数 258 浏览 5 评论 0原文

我有一个包含多个项目的 Visual Studio 解决方案,并将项目之间的引用设置为项目引用。

添加对程序集的引用后,引用的属性包含

特定版本 = True|False

的设置,项目引用缺少此属性。 怎么设置呢? 我希望我的解决方案能够加载 bin 文件夹中的任何可用程序集(无论什么版本)。

当工作流实例(Workflow Foundation)被反序列化并且同时更新依赖项时,我遇到了问题。

I have got a Visual Studio Solution containing several projects and have set up the references between the projects as project references.

When a reference to an assembly is added, the references' properties contain a setting for

Specific Version = True|False

This property is missing for project references. How can it be set? I'd like my solution to load any available assembly (no matter what version) in the bin folder.

I've had a problem when a workflow instance (Workflow Foundation) was deserialized and the dependencies were updated meanwhile.

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

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

发布评论

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

评论(4

高速公鹿 2024-07-29 06:56:10

我认为问题在于,您所要求的内容不可能直接通过项目引用来实现,我认为由于链接的性质,它总是隐式地变成“显式版本”。

可以执行此操作的方式(调用当前引用的项目 A 和引用的项目 B):

  • 在解决方案中包含要引用的项目,就像您现在使用项目引用
  • 显式设置 一样依赖链,因此首先构建“引用”项目 首先
  • 手动构建引用的项目 A 一次
  • 在项目 B 中创建对项目 A 中构建结果的程序集引用
  • 将程序集引用设置为“特定版本 = false”

构建顺序(依赖)将保证 A 始终在 B 之前构建,并且 B 将从 A 的二进制输出目录中引用它。

(不过,它有点脆弱,我不会推荐它,因为如果设置是很容易得到错误的结果)不太好,或者太阳与星星的排列错误,或者诸如此类的)

I think the problem is that what you are asking is not possible directly with a project reference, I think that always implicitly turns into an 'explicit version', because of the nature of the link.

The way you could do this (calling the currently referenced project A, and the referencing project B):

  • Have the project you want to reference in your solution, just like you do now with the project reference
  • Explicitly set the dependency chain so the 'referenced' project is built first
  • Build the referenced project A once first manually
  • Create an assembly reference in project B to the results from the build in project A
  • Set the assembly reference to 'Specific Version = false'

The build order (dependency) will guarantee that A is always built before B, and B will reference it from the binary output directory of A.

(altho, it's a little brittle and I would not recommend it since it's easy to get wrong results if the settings are not all right, or the sun aligns with the stars wrong, or some such)

悲欢浪云 2024-07-29 06:56:10

我可能会误解您的问题,但是当您添加项目引用时,项目的程序集始终会加载到构建项目时引用它的任何项目中。 因此,您将始终在该项目的 bin 文件夹中拥有最新的可用程序集。 在这方面,VS 对待项目的方式与其他程序集不同。

I might be misunderstanding your question, but when you add a project reference, the project's assembly is always loaded into any project that references it when the project is built. Therefore, you'll always have the latest available assembly in the bin folder for that project. VS treats projects differently than other assemblies in that regard.

久隐师 2024-07-29 06:56:10

您可以添加对项目输出 dll 而不是项目的引用。 然后您将能够设置特定版本设置。

You can add references to project output dlls instead of projects. Then you will be able to set Specific Version setting.

沐歌 2024-07-29 06:56:10

我已经找到了解决我的问题的方法。 此处描述得非常详细。
问题不是错误的项目引用问题,而是工作流实例的反/序列化问题。

感谢所有试图提供帮助的人。

I have found the solution to my problem. It's described pretty detailed here.
The problem is not a matter of wrong project references, but more a de/serializing of workflow instances question.

Thanks to everybody who tried to help.

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