那么,是否可以添加的C#Windows EXE作为另一个C#的winform的参考? [英] Is it right to add c# windows exe as reference in another c# winform?

查看:135
本文介绍了那么,是否可以添加的C#Windows EXE作为另一个C#的winform的参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有C#WinForm应用程序。而我能够这样exe文件添加为另一个WinForm应用程序的参考。

I have c# winform application. and I am able to add this exe as reference in another winform application.

这是伟大的工作就像DLL类型。

It is working great like dll type.

截至目前,我没有看到任何问题。是否有我需要考虑在这种情况下的任何问题。

As of now, I don't see any issues. Is there any issues I need to look into in this case.

推荐答案

是的,这是好的。在CLR实际上并不关心在所有有关文件扩展名,也不当你添加一个参考IDE。

Yes, this is fine. The CLR doesn't actually care at all about the filename extension, nor does the IDE when you add a reference.

所有的CLR知道是的显示名称的程序集。换句话说,当它被要求寻找一个组件,然后它进入由全名首。例如:

All that the CLR knows is the display name of an assembly. In other words, when it is asked to look for an assembly then it goes by the full name first. For example:

    ClassLibrary1, Version=1.2.3.4, Culture=neutral, PublicKeyToken=b77a5c561934e089

它首先在GAC一个的确切的匹配上显示名称(ClassLibrary1的),版本和令牌。如果做不到这一点,它会去寻找在你的程序的探测路径的文件。只是ClassLibrary1的。请注意,没有文件扩展名是在所有指定。将首先尝试找到ClassLibrary1.EXE。如果做不到这一点,它接下来将尝试找到ClassLibrary1.DLL'。没有进一步扩展试过了。你可以看到这个被用做Fuslogvw.exe顺便说一句。

It first looks in the GAC for an exact match on the display name (ClassLibrary1), version and token. Failing that, it then goes looking for a file in the probing path of your program. Just "ClassLibrary1". Note that no filename extension is specified at all. It will first attempt to find "ClassLibrary1.EXE". Failing that, it next tries to find "ClassLibrary1.DLL'. No further extensions are tried. You can see this being done with Fuslogvw.exe btw.

请注意如何有这种方法相关的棘手的问题,一个DLL不能有相同的文件名作为一个EXE文件。当它被要求来解决DLL程序集的CLR将加载EXE,这是当然的KABOOM。被发现的the艰辛的道路。它会查找一个EXE第一,而不是最后就是,好了,奇怪的。

Note how there's a nasty problem associated with this approach, a DLL cannot have the same filename as an EXE. The CLR will load the EXE when it is asked to resolve the DLL assembly. That's a kaboom of course. A problem that is discovered the hard way. That it looks for an EXE first instead of last is, well, odd.

所以,没什么可担心的。只是重命名的.exe为.dll是罚款为好。

So, nothing to fret about. Just renaming the .exe to a .dll is fine as well.

这篇关于那么,是否可以添加的C#Windows EXE作为另一个C#的winform的参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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