简体   繁体   English

如何在Visual Studio中将附属程序集添加到项目中

[英]How to add satellite assemblies to a project in Visual Studio

I'm working in a project which references assemblies from a third company. 我正在参与一个引用第三家公司组件的项目。 These assemblies have satellite assemblies that I'm copying with a post-build event to the bin folder. 这些程序集具有我正在使用post-build事件复制到bin文件夹的附属程序集。

Is There a way to include those third party satellite assemblies into the project so I have not to care with the post-build events and maintaining the files? 有没有办法将这些第三方附属程序集包含在项目中,所以我不关心后期构建事件和维护文件?

Thanks in advance. 提前致谢。

MORE INFORMATION: As the references have only resources they are not added as project references, actually I'm just copying them to the // folder. 更多信息:由于引用只有资源,它们不会作为项目引用添加,实际上我只是将它们复制到//文件夹。 As each localized reference has the same name I would only be able to add it one time to the project's references. 由于每个本地化的引用具有相同的名称,我只能将它添加一次到项目的引用。

It is automatic in the C# IDE. 它在C#IDE中是自动的。 Setting Copy Local = True on the assembly reference ensures that the satellite assemblies get copied as well. 在装配参考上设置Copy Local = True可确保也可以复制附属装配。 In the C++ IDE it is a setting: Framework + References, Build properties category, "Copy Local Satellite Assemblies". 在C ++ IDE中,它是一个设置:Framework + References,Build properties category,“Copy Local Satellite Assemblies”。

There's not enough info in your question to narrow down which IDE you use or why it wouldn't work for you. 您的问题中没有足够的信息来缩小您使用的IDE或为什么它不适合您。 Maybe that 3rd party is doing something non-standard. 也许第三方正在做一些非标准的事情。 Give them a call. 给他们打个电话。

I was researching a related problem and stumbled on this thread. 我正在研究一个相关的问题,偶然发现了这个问题。 Please note that referencing the satellite assemblies directly (via the 'add reference' dialog) is not the way to incorporate them into your application. 请注意,直接引用附属程序集(通过“添加引用”对话框)并不是将它们合并到应用程序中的方法。 In stead just make sure they are located in a folder hierarchy as suggested above (relative to the original location of the binary file they contain resources for). 相反,只需确保它们位于上面建议的文件夹层次结构中(相对于它们包含资源的二进制文件的原始位置)。

The only file you add a reference to explicitly is the library itself. 您明确添加引用的唯一文件是库本身。 Do remember to set 'copy local' to true in the property window of the reference. 请记住在引用的属性窗口中将“copy local”设置为true。 The runtime will then make sure to pull resources from the file whose directory matches the system locale. 然后,运行时将确保从目录与系统区域设置匹配的文件中提取资源。

In the references, right click and select properties on your reference to the third party assembly. 在引用中,右键单击并选择对第三方程序集的引用的属性。

Ensure that "copy local" is true. 确保“复制本地”为真。

If this is true, then it should copy the satellite assemblies, as this is the behavior I've experienced in Visual Studio. 如果这是真的,那么它应该复制附属程序集,因为这是我在Visual Studio中遇到的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM