将DLL静态链接到CLR控制台应用程序? [英] Statically Link DLL to CLR Console App?

查看:73
本文介绍了将DLL静态链接到CLR控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;

我正在尝试创建自包含"的托管CLR控制台应用程序,
无需安装任何东西就可以运行,而我遇到了
有点情况.

看起来,即使我已经指定了纯" clr构建,还是有些
无论如何,在该内部版本中都使用了非托管DLL.当我创建
CLR控制台应用程序项目,进行构建,然后将生成的可执行文件移植到
到未安装.NET Framework的系统(系统
在这种情况下运行Windows 2000),我会收到以下错误消息:
================================================== ===================
未处理的异常:System.TypeInitializationException:类型初始值设定项
的< Module>''引发了异常.
---> System.DllNotFoundException:无法加载DLL"msvcm90d.dll":
指定的模块无法找到. (来自HRESULT的异常:0x8007007E)
在< CrtImplementationDetails>处.ThrowModuleLoadException(String,Exception)
位于< CrtImplementationDetails> .LanguageSupport.Initialize(LanguageSupport *)
在.cctor()
---内部异常堆栈跟踪的结尾---
================================================== ===================



我想提及的一件事是,在创建该项目时,我做了
没什么.我按原样保留它-Console :: WriteLine(L"Hello World");主要.
我创建了一个项目来演示问题的性质,并且
问题不在于我的代码,也不在于我正在做的任何事情.

我以为,如果我尝试禁用语言扩展,可能就不会
请参考DLL,但不要碰运气.

在建筑物上,我得到以下信息:
命令行错误8016:选项``/Za''和``/clr:pure''不兼容.

我试图从多线程DLL"(/MD)更改运行时库
到多线程"(/MT),但这也不起作用.编译时,
我得到:
/MTd和/clr:Pure不兼容

我必须使用带有clr选项的/MD(或/MDd)进行编译
(/MD =>多线程DLL").

显然,这是我要获取(不受管理的)msvcm90d.dll的地方.

我一直在尝试找出如何将该库静态链接到
可执行文件,但是我还没有发现任何可以明确告诉我的内容
该怎么做.

我尝试将"/FU msvcm90d.dll"添加到命令行进行编译,
但这对我没有任何好处.

我还尝试了#include"msvcm90d.dll",但没有任何效果.

这是我需要帮助的地方.

如何将该DLL静态链接到生成/可执行文件?

任何其他意见或建议,将不胜感激.

Hi all;

I am trying to create a managed CLR console app that is "self-contained",
that can be run without having to install anything, and I''ve run into a
bit of a situation.

It would seem that, even though I''ve specified a "pure" clr build, some
unmanaged DLL''s are being utilized within that build anyway. When I create
a CLR Console App project, build it, then port the resulting executable over
to a system that does not have the .NET framework installed (a system
running Windows 2000 in this case), I get the following error message:
======================================================================
Unhandled Exception: System.TypeInitializationException: The type initializer
for ''<Module>'' threw an exception.
---> System.DllNotFoundException: Unable to load DLL ''msvcm90d.dll'':
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at <CrtImplementationDetails>.ThrowModuleLoadException(String , Exception )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
--- End of inner exception stack trace ---
======================================================================



One thing that I want to mention is that, in creating that project, I did
nothing to it. I left it "as is" - Console::WriteLine(L"Hello World"); in main.
I created the project to demonstrate the nature of the problem, and the
problem is not with my code, nor with anything that I am doing.

I thought that maybe if I tried to disable language extensions, it might not
reference the DLL, but no luck with that.

On building, I get the following:
Command line error 8016: options ''/Za'' and ''/clr:pure'' are not compatible.

I tried to change the Run-time library from "Multi-threaded DLL" (/MD)
to "Multi-threaded" (/MT), but that won''t work either. On compilation,
I get:
/MTd and /clr:Pure are incompatible

I must compile with /MD (or /MDd) with clr option
(/MD => "Multi-threaded DLL").

Apparently, this is where I am getting the (unmanaged) msvcm90d.dll.

I''ve been trying to figure out how to statically link that library to
the executable, but I''ve not found anything that tells me explicitly
how to do that.

I tried adding "/FU msvcm90d.dll" to the command line for compilation,
but that didn''t do me any good.

I''ve also tried #include "msvcm90d.dll", with no effect.

This is where I need some help.

How do I statically link that DLL to the build/executable?

Any other comments or suggestions would be appreciated.

Thanks!!!

推荐答案

CLR =公共语言运行时= .net框架.


CLR = Common Language Runtime = .net framework.


wylbur写道:

我正在尝试创建一个自包含"的托管CLR控制台应用程序,
无需安装任何东西即可运行的
...
我创建一个CLR Console App项目,进行构建,然后将生成的可执行文件移植到未安装.NET Framework的系统上.

I am trying to create a managed CLR console app that is "self-contained",
that can be run without having to install anything,
...
I create a CLR Console App project, build it, then port the resulting executable over to a system that does not have the .NET framework installed



在我看来,这意味着:我正在编写一个绝对需要.NET框架才能运行的程序.如何在没有.NET框架的情况下使其运行?"

我认为您需要退后一步,重新考虑您的目标和需求,以及达到目标所用的方法.



In my mind this translates to: "I am writing a program that absolutely requires the .NET framework to run. How do I make it run without the .NET framework?"

I think you need to step back and reconsider your goals and needs and what methods you are using to get there.


Avi;

我看不到任何在该论坛中引用帖子的方法-也许我错过了
在某处.

无论如何,只要您愿意,我都可以称我为肥大,笨拙,笨蛋",
但是某种程度上我给人的印象是,曾经.NET应用程序被
编译成MSIL,它不需要.NET框架即可运行
在另一个系统上.

所以我想我是个白痴-是吗?

感谢您的回复.
Hi Avi;

I don''t see any way to quote a post in this forum - maybe I missed
something somewhere.

In any case, you can call me a "big, fat, stupid, dummy-head" if you like,
but I was somehow under the impression that, once a .NET app was
compiled into MSIL, it didn''t require the .NET framework to run
on another system.

So I guess I was being an idiot with that - yes?

Thanks for the response.


这篇关于将DLL静态链接到CLR控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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