部署使用dll的c#可执行文件。 [英] Deploying c# executables that uses dll's.

查看:97
本文介绍了部署使用dll的c#可执行文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

回到过去,我编译了一个C ++可执行文件,将这个可执行文件使用的dll''''''''''''''''''''''''''''''''''''''''''转到另一台计算机,复制该文件夹

本地,双击exe文件然后我们去....


今天,我有一个C# .NET可执行文件,我将使用过的.NET dll复制到相同的

文件夹中。去了另一台计算机本地复制了该文件夹。我在exe文件上双击

以及许多看起来像Access违规的错误,除了

它被篡改不同。


微软的口号不再是dll-hell,但这对我来说是一个真正的dll

地狱。 :-(


所以现在的问题是:当它发现它没有安装时,怎样才能使exe安装/注册/任何

这个dll然而。

一个sollution可能会创建一个安装项目,另一个是某种方式

手动添加这个dll,但我希望不要打扰任何这些用户

额外的步骤。


我在互联网上看到很多网页部署的例子,但到目前为止

对普通可执行文件没什么用处。


还有意思的是,为什么exe启动代码没有检查是否安装了

..NET框架工作还是网络?

回到过去,exe至少告诉你,你需要Windows以

命令运行这个可执行文件(Stub),但今天的.NET可执行文件给出了

一些奇怪的错误,比如丢失的mscoree.dll或者甚至可怕的东西。而且每次我遇到另一台没有

的电脑时,它会让我感到害怕。 .NET fra安装mework。


任何提示都是欢迎的。 :-)


(我正在使用C#2002版本)

解决方案

< Ol *** *******@skyscan.be>写道:

回到过去,我编译了一个C ++可执行文件,将这个可执行文件使用的dll'复制到同一个文件夹中。转到另一台计算机,在本地复制该文件夹,双击exe文件然后我们就去....

今天,我有一个C#.NET可执行文件,我复制了二手文件.NET dll进入相同的
文件夹。去了另一台计算机本地复制了该文件夹。我双击了exe文件上的
和许多看起来像Access违规的错误,除非它被篡改不同。


它究竟是什么样的*?在不知道答案的情况下,

很难说出什么是错的。

而且有趣的是,为什么exe启动代码没有检查如果
.NET框架工作安装或网络?




我认为文件链接的方式会非常棘手。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复群组,请不要邮寄我也是


> >今天,我有一个C#.NET可执行文件,我将使用过的.NET dll复制到

相同的

文件夹中。去了另一台计算机本地复制了该文件夹。我加倍
点击exe文件和很多看起来像违规行为的错误
除了它被篡改不同。



和*完全*是什么说什么?在不知道答案的情况下,很难说出什么是错的。




这里有一个消息框,我有不知道出了什么问题。

----------

标题:appl-name - Commom语言运行时调试服务

消息:应用程序生成了一个无法处理的异常。

进程id = 0x3ec(1004),线程id = 0x3a4(932)

单击OK终止应用

点击取消调试应用程序

----------


机器是Win2000。在我开发的机器上(win2000)这个东西

完美无缺。

我相信这是因为他没有找到我创建的.NET dll

并分发。

奇怪的是这个dll实际上位于exe的同一位置。

如果这是一个正常的dll和exe

那么这将是完美的。


代码没有错,因为我只是启动表单而不做

花哨的东西。

至少我应该有一个带有菜单项的表格,一些标签和

一些按钮。

但是它甚至在之前崩溃了我看到任何形式。 Mysterie,mysterie,

mysterie ......

还有趣的是,为什么exe启动代码没有检查如果
安装了.NET框架工作或网络?



我认为文件链接的方式会非常棘手。


但是用户友好得多。

但是没有安装.NET的人开始执行这个程序

可能会引起恐慌并打电话给IT。

我要做的最后一件事就是不断告诉人们,他们需要先安装.NET,然后再试一次。


你是什么意思.Net dll,你在目标上安装.Net框架

机吗?在制作C#程序时,您只需将程序编译为.exe

文件。当您安装.net框架时,任何属于.net框架的DLL文件都安装在

计算机上。不需要包含它,但是你需要安装.net框架。


此外,C#2002使用框架v1.0。我不确定最新的框架

安装程序是否也安装v1.0或仅安装v1.1(2003版)。您可能需要

安装框架1.0(不要担心它不会覆盖任何v1.1)。


-

使用M2,Opera的革命性电子邮件客户端: http:/ /www.opera.com/m2/


Back in the Old days, I compile a C++ executable, copy the dll''s used by
this executable to the same folder. Go to another computer, copy that folder
locally, double click on the exe file and off we go....

Today, I have a C# .NET executable, I copied the used .NET dll into the same
folder. Went to the other computer copied the folder locally. I double click
on the exe file and a lot of errors that looks like Access violations except
it is caled differently.

The Microsoft slogan is no more dll-hell, but this is for me a real dll
hell. :-(

So the question now is: how can I make the exe install/register/whatever
this dll when it discovers that it is not installed yet.
One sollution is probaly to create a setup project, another is somehow
manually add this dll, but I wish not to bother any users with these
additional steps.

I see a lot of examples for web deployment, on the Internet, but so far
nothing usefull for normal executables.

And also interesting, why does the exe startup code not have an check if the
..NET frame work is installed or net?
Back in the Old days, the exe at least told you that you needed Windows in
order to run this executable (Stub) but the .NET executables today gives
some wierd error like a missing mscoree.dll or something even scary. And it
scares the hell out of me every time I meet another computer that has no
..NET framework installed.

Any tips are welcom. :-)

(I am using C# 2002 version)

解决方案

<Ol**********@skyscan.be> wrote:

Back in the Old days, I compile a C++ executable, copy the dll''s used by
this executable to the same folder. Go to another computer, copy that folder
locally, double click on the exe file and off we go....

Today, I have a C# .NET executable, I copied the used .NET dll into the same
folder. Went to the other computer copied the folder locally. I double click
on the exe file and a lot of errors that looks like Access violations except
it is caled differently.
And what *exactly* is it saying? Without knowing the answer to that,
it''s hard to say what''s wrong.
And also interesting, why does the exe startup code not have an check if the
.NET frame work is installed or net?



The way that the file is linked would make that quite tricky, I think.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


> > Today, I have a C# .NET executable, I copied the used .NET dll into the
same

folder. Went to the other computer copied the folder locally. I double click on the exe file and a lot of errors that looks like Access violations except it is caled differently.



And what *exactly* is it saying? Without knowing the answer to that,
it''s hard to say what''s wrong.



Here it comes in a message box, I have no clue what goes wrong.
----------
Title: appl-name - Commom Language Runtime Debugging Services
Message: Application has generated an exception that could not be handeled.
Process id=0x3ec (1004), Thread id=0x3a4(932)
Click OK to terminate the application
Click CANCEL to debug the application
----------

The machine is Win2000. On my machine where I develop (win2000) this thing
works perfect.
I believe that it is because he does not find the .NET dll I also created
and distributed.
The odd thing is that this dll is actually at the same location of the exe.
If this was a normal dll and exe
then this would work perfect.

Nothing is wrong in the code since I only start up the form without doing
fancy stuff.
At the very least I should have a form with a menu item, some labels and
some buttons.
But it crashes even before I see any form at all. Mysterie, mysterie,
mysterie...

And also interesting, why does the exe startup code not have an check if the .NET frame work is installed or net?



The way that the file is linked would make that quite tricky, I think.


But far more user friendly.
But someone that starts to execute this program without the .NET installed
will probably panic and call IT.
The last thing I want to do is keep telling people at the phone that they
need to install .NET first and try again.


What do you mean .Net dll, have you installed .Net framework on the target
machine? When making a C# program you just compile the program into a .exe
file. Any dll files that belong to .net framework is installed on the
computer when you install .net framework. No need to include it, but you
do need to have .net framework installed.

Also, C# 2002 uses framework v1.0. I''m not sure if the latest framework
installers also install v1.0 or only v1.1 (2003 version). You may have to
install framework 1.0 (don''t worry it won''t overwrite anything v1.1).

--
Using M2, Opera''s revolutionary e-mail client: http://www.opera.com/m2/


这篇关于部署使用dll的c#可执行文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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