VB.net。编译时,使用引用的.NET dlls文件将所有文件结束。 [英] VB.net. Bring all files over with referenced .NET dlls files when compiling.

查看:86
本文介绍了VB.net。编译时,使用引用的.NET dlls文件将所有文件结束。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我目前正在构建依赖于其他.NET dll的VB.NET应用程序。其中一些Dll使用DevX控件。



当编译这些dll时,他们将引入的DevX控件引入他们的bin \(build)文件夹。



问题是,当我编译一个依赖于使用DevX的dll的Winform应用程序时,我只获取了Winform bin \(build)文件夹中的dll 。



是否有一个我还没有找到的设置,当我编译我的Winform应用程序时,我可以将所有文件拉到我的Winform app Bin文件夹中.NET dll使用的不仅仅是dll吗?



谢谢,

Chris

解决方案

是的。看看它是如何工作的。 Microsoft希望每个人都引用一些程序集(在.NET中,关键单元是程序集,DLL只是 modules 之一),使用它们中的某些类型,并且所有程序都可以正常工作。为此,默认情况下,为每个配置创建一个单独的输出文件。在另一个项目中引用程序集时,引用程序集的可执行模块会自动复制到引用程序集的相应(每个配置)输出目录。当然,如果该引用程序集本身被其他程序集引用,那么所有这些模块都会级联复制到另一个输出目录,依此类推。



当然,这个效率不高,但 无人关心 ,因为所有应该立即工作的原则似乎更重要。



但是,如果你做了认真的发展,并且不介意为了额外的方便,你可以关心那些额外的工作。您可以转到项目属性窗口,构建选项卡,并根据每个配置单独更改输出目录的所有相对路径。在极少数情况下,您只需编译不同的指令集架构(应尽可能避免使用AnyCPU是最好的),您可以根据每个平台配置对进行编译。



我强烈建议将所有输出目录合并到一个目录,但每个配置。



然而,我做了一个更进一步,做一些(太糟糕)的事情不能直接在IDE中完成。我手动编辑项目文件的元素< OutputPath> 到这个字符串

 <   OutputPath  >  .. \ bin。


(配置)\ < < span class =code-leadattribute> / OutputPath >



在默认项目中,只有两个这样的元素(默认配置为Debug 和发布),但我使这两个元素相同 - MSBuild属性系统根据配置名称自动计算不同的路径。如果所有configuration-platfom组合必须是不同的路径,则可以将属性


(Platform)添加到此命名模式。 ..的数量取决于解决方案文件结构中项目文件的深度。



当您看到此类操作的结果时IDE(Visual Studio),您可以在属性窗口中看到正确的路径。只需不要再次在IDE中手动触摸它,转到原始项目文件。



这很简单,大大简化了输出文件的管理,减少了磁盘空间。



另见我过去的答案: 运行时加载mytest.dll时出错



-SA

Hi,

I am currently building VB.NET applications which are dependent upon other .NET dlls. Some of those Dlls use DevX controls.

When those dlls are compiled they pull in the DevX controls they reference into their bin\(build) folder.

Question is, When I compile a Winform app which is dependent upon a dll which uses DevX, I only get the dll in my Winform bin\(build) folder.

Is there a setting I have not found yet so, that when I compile my Winform app, I can get all files pulled into my Winform app Bin folder which my .NET dll uses and not only the dll?

Thanks,
Chris

解决方案

Yes. Look how it works. Microsoft wants everyone to reference some assemblies (in .NET, the key unit is assembly, "DLL" is just one of modules), use some types from them, and all works right away. For this purpose, by default, a separate output file is created for every assembly, per configuration. When you reference the assembly in another project, the executable modules of referenced assemblies are automatically copied to the corresponding (per configuration) output directories of the referencing assembly. Naturally, if that referencing assembly is itself referenced by some other assembly, all those modules are cascade-copied to another output directory, and so on.

Of course, this is not very efficient, but nobody cares, because the principle "all should work right away" seems to be more important.

If you do serious development, however, and would not mind a bit of extra work for the sake of extra convenience, you can care about that. You can go to the project "Properties" window, the "Build" tab, and change all the relative paths for "Output directories", separately per each configuration. In rare cases when you just have to compile for different instruction-set architectures (should be avoided whenever possible, "AnyCPU is the best), you do it per each platform-configuration pair.

I would strongly recommend to merge all output directories to one directory, but per configuration.

However, I make a step further and do something which is (too bad) cannot be done directly in the IDE. I manually edit the element <OutputPath> of the project files to this string

<OutputPath>..\bin.


(Configuration)\</OutputPath>


In a default project, there are only two such elements (per default configurations "Debug" and "Release"), but I make these two elements identical — the MSBuild property system automatically calculates different paths based on configuration names. If all configuration-platfom combinations have to be distinct paths, you can add the property


(Platform) to this naming schema. The number of ".." varies depending on the depth of the project file in the file structure of the solution.

When you see the result of such manipulations from withing IDE (Visual Studio), you can see correct paths in the property window. Only don't touch it manually in the IDE again, go to the raw project file.

This is easy and considerably simplifies the management of the output files, takes less disk space.

See also my past answer: Error on Load mytest.dll at runtime.

—SA


这篇关于VB.net。编译时,使用引用的.NET dlls文件将所有文件结束。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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