C#64位DLL? [英] C# 64-bit DLL?

查看:90
本文介绍了C#64位DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我使用C#开发使用Visual Studio 2005和.Net 2.0的DLL,而且我不知道如何使我的DLL工作在64位平台上使用应用程序。

最重要的是,我没有在我的64位DLL中使用任何新功能。所以,我希望

来检查一般规则,


1.对于C#,是否需要进行两个单独的构建(32位和64位) -bit)

根据使用DLL的应用程序(32位还是64位)?即
提供我的64位C#DLL的64位应用程序,并提供32位应用程序

在我的32位DLL的64位平台上运行?


2.如果我们必须制作两个单独的版本,如何在Visual Studio中完成它?
2005?我只找到项目中任何CPU的设置名称--properties。

提前感谢,

George

解决方案
"乔治" < Ge **** @ discussion.microsoft.com写信息

新闻:D9 ************************ ********** @ microsof t.com ...


大家好,


我我正在使用C#开发使用Visual Studio 2005和.Net 2.0的DLL,而且我不知道如何使我的DLL在64位上使用应用程序

平台。

最重要的是,我没有在我的64位DLL中使用任何新功能。所以,我想要

检查一般规则,



检查你的项目构建属性,默认平台目标选项是

设置为* AnyCpu *,这意味着你的DLL将在64位进程中加载​​

时运行为64位,加载时为32位在32位进程中。


1.对于C#,是否需要进行两个单独的构建(32位和64位)

根据使用DLL的应用程序(32位还是64位)? ie

提供我的64位C#DLL的64位应用程序,并提供32位
应用程序

在64位平台上运行我的32位DLL?



不,在构建DLL时,最好保留默认的平台

(AnyCpu)。

在讨论可执行程序集时,事情会变得复杂一些。

如果你的应用程序真的需要扩展的寻址范围

64bit Windows ,那么你必须构建你的exe作为64位应用程序

(平台= X64或IA64,具体取决于平台),这样的应用程序无论如何都不能在X86上运行
。 br />
但是,如果您不需要扩展寻址功能而且您不需要在IA64上运行
,那么您最好将平台设置为X86 ;。这样,你的应用程序在所有Windows平台(IA32和X64)上以32位运行。


2.如果我们必须制作两个独立的构建,如何在Visual Studio中实现它?
2005?我只找到项目中任何CPU的设置名称--properties。



你应该有AnyCpu,X86,X64和Itanium,你是什么版本的VS2005? />
正在运行?


Willy。


谢谢Willy,


我有另一个DLL引用这个DLL,但是另一个DLL是原生的

非托管本机代码(C ++),它不是基于.Net的。在我的案例中如何构建C#

DLL?是*任何CPU *设置好吗?

问候,

乔治


" Willy Denoyette [MVP]"写道:


" George" < Ge **** @ discussion.microsoft.com写信息

新闻:D9 ************************ ********** @ microsof t.com ...


大家好,

我正在使用C#来使用Visual Studio 2005和.Net 2.0开发DLL,而且我不知道如何让我的DLL在64位
平台上运行应用程序。

最重要的是,我没有在我的64位DLL中使用任何新功能。所以,我需要

检查一般规则,



检查你的项目构建属性,默认平台目标选项是

设置为* AnyCpu *,这意味着你的DLL将在64位进程中加载​​

时运行为64位,加载时为32位在32位进程中。


1.对于C#,是否需要进行两个单独的构建(32位和64位)

根据使用DLL的应用程序(32位还是64位)? ie

提供我的64位C#DLL的64位应用程序,并提供32位
应用程序

在64位平台上运行我的32位DLL?



不,在构建DLL时,最好保留默认的平台

(AnyCpu)。

在讨论可执行程序集时,事情会变得复杂一些。

如果你的应用程序确实需要扩展的寻址范围,那么你需要使用

64位Windows构建你的exe作为64位应用程序

(平台= X64或IA64,具体取决于平台),这样的应用程序无论如何都不能在X86上运行。

但是,如果您不需要扩展寻址功能并且您不需要在IA64上运行
,那么您最好将平台设置为X86。这样,你的应用程序在所有Windows平台(IA32和X64)上以32位运行。


2.如果我们必须制作两个独立的构建,如何在Visual Studio中实现它?
2005?我只找到项目中的任何CPU的设置名称--properties。



你应该拥有AnyCpu,X86,X64和Itanium,你用什么版本的VS2005

运行?


Willy。


是的AnyCpu还可以。


它''是托管程序集的主要入口点,它确定加载哪个CLR

版本。

因此,如果您有本机代码依赖项,那么您的主程序集将需要

指定与本机DLL相同的位数。

托管exe 64位(x64)---托管DLL(AnyCPU) - 非托管代码( X64)

托管exe 64位(IA64)---托管DLL(AnyCPU) - 非托管代码

(IA64)

托管exe 64位(x86)---托管DLL(AnyCPU) - 非托管代码(X86)

都可以,其他组合都没有。


Willy 。


" George" < Ge **** @ discussion.microsoft.com写信息

新闻:1B ************************ ********** @ microsof t.com ...


谢谢威利,


我有另一个DLL引用这个DLL,但另一个DLL是原生的

非托管本机代码(C ++),它不是基于.Net的。在我的案例中如何构建C#

DLL?是*任何CPU *设置好吗?


问候,

George


" Willy Denoyette [MVP] "写道:


>" George" < Ge **** @ discussion.microsoft.com写信息
新闻:D9 **************************** ****** @ microso ft.com ...


大家好,


我用C#来使用Visual Studio 2005和.Net 2.0开发DLL,并且



不知道如何使我的DLL与64位应用程序一起工作

平台。

最重要的是,我没有在我的64位DLL中使用任何新功能。所以,我需要

来检查一般规则,


检查项目构建属性,默认的平台目标选项
设置为* AnyCpu *,这意味着你的DLL在64位进程中加载​​时将作为64位运行,而在32位加载时运行为32位进程。


1.对于C#,是否需要进行两个单独的构建(32位和

64位)

根据使用DLL的应用程序(32位或64位)?



提供64位应用程序我的64-位C#DLL,并提供32位
应用程序

在64位平台上运行我的32位DLL?


不,在构建DLL时,最好保留默认的平台
(AnyCpu)。
在谈论可执行程序集时,事情会变得更复杂。
如果您的应用程序确实需要
64位提供的扩展寻址范围Windows,那么你必须构建你的exe作为64位应用程序
(平台= X64或IA64,具体取决于平台),这样的应用程序无论如何都无法在X86上运行。
但是,如果您不需要扩展寻址功能并且您不需要在IA64上运行,那么您最好将平台设置为X86。这样,你的应用程序在所有Windows平台(IA32和X64)上运行为32位。


2.如果我们必须进行两个单独的构建,怎么用Visual

Studio

2005?我只找到项目中任何CPU的设置名称 - >

属性。


你应该有AnyCpu,X86,X64和Itanium,什么版本VS2005是运行吗?

威利。



Hello everyone,
I am using C# to develop DLL using Visual Studio 2005 and .Net 2.0, and I
have no idea of how to make my DLL work with applications on 64-bit platform.
Above all, I do not utilize any new features in my DLL of 64-bit. So, I want
to check the general rules,

1. For C#, is there a need to make two separate builds (32-bit and 64-bit)
according to the application (32-bit or 64-bit) which uses the DLL? i.e.
provide 64-bit application my 64-bit C# DLL, and provide 32-bit application
runs on 64-bit platform my 32-bit DLL?

2. If we have to make two separate builds, how to do it in Visual Studio
2005? I only find a setting names for Any CPU in project --properties.
thanks in advance,
George

解决方案

"George" <Ge****@discussions.microsoft.comwrote in message
news:D9**********************************@microsof t.com...

Hello everyone,
I am using C# to develop DLL using Visual Studio 2005 and .Net 2.0, and I
have no idea of how to make my DLL work with applications on 64-bit
platform.
Above all, I do not utilize any new features in my DLL of 64-bit. So, I
want
to check the general rules,

Check your Project Build Properties, the default Platform target option is
set to *AnyCpu*, which mean that your DLL will run as a 64 bit when loaded
in a 64 bit process and as 32 bit when loaded in a 32 bit process.

1. For C#, is there a need to make two separate builds (32-bit and 64-bit)
according to the application (32-bit or 64-bit) which uses the DLL? i.e.
provide 64-bit application my 64-bit C# DLL, and provide 32-bit
application
runs on 64-bit platform my 32-bit DLL?

No, when building a DLL you better keep the default Platform as is
("AnyCpu").
When talking about an executable assembly things get a bit more complicated.
If your application really needs the extended addressing range offered by
64bit Windows, then you have to build your exe as a 64 bit application
(Platform = X64 or IA64 depending on the platform), such application cannot
run on X86 anyway.
However, if you don''t need the extended addressing capability AND you don''t
need to run on IA64, then you better set the Platform to "X86". This way,
your appplication runs as 32 bit on all Windows platforms (IA32 and X64).

2. If we have to make two separate builds, how to do it in Visual Studio
2005? I only find a setting names for Any CPU in project --properties.

You should have AnyCpu, X86, X64 and Itanium, what version of VS2005 are you
running?

Willy.


Thanks Willy,

I have another DLL which reference this DLL, but the other DLL is native
unmanaged native code (C++), and it is not .Net based. How to build the C#
DLL in my case? Is *Any CPU* setting ok?
regards,
George

"Willy Denoyette [MVP]" wrote:

"George" <Ge****@discussions.microsoft.comwrote in message
news:D9**********************************@microsof t.com...

Hello everyone,
I am using C# to develop DLL using Visual Studio 2005 and .Net 2.0, and I
have no idea of how to make my DLL work with applications on 64-bit
platform.
Above all, I do not utilize any new features in my DLL of 64-bit. So, I
want
to check the general rules,


Check your Project Build Properties, the default Platform target option is
set to *AnyCpu*, which mean that your DLL will run as a 64 bit when loaded
in a 64 bit process and as 32 bit when loaded in a 32 bit process.

1. For C#, is there a need to make two separate builds (32-bit and 64-bit)
according to the application (32-bit or 64-bit) which uses the DLL? i.e.
provide 64-bit application my 64-bit C# DLL, and provide 32-bit
application
runs on 64-bit platform my 32-bit DLL?


No, when building a DLL you better keep the default Platform as is
("AnyCpu").
When talking about an executable assembly things get a bit more complicated.
If your application really needs the extended addressing range offered by
64bit Windows, then you have to build your exe as a 64 bit application
(Platform = X64 or IA64 depending on the platform), such application cannot
run on X86 anyway.
However, if you don''t need the extended addressing capability AND you don''t
need to run on IA64, then you better set the Platform to "X86". This way,
your appplication runs as 32 bit on all Windows platforms (IA32 and X64).

2. If we have to make two separate builds, how to do it in Visual Studio
2005? I only find a setting names for Any CPU in project --properties.

You should have AnyCpu, X86, X64 and Itanium, what version of VS2005 are you
running?

Willy.


Yes AnyCpu is ok.

It''s the main entry point of the managed assembly who determines which CLR
version that gets loaded.
So if you have native code dependencies, then your main assembly will need
to specify the same bit-ness as the native DLL.

Managed exe 64 bit (x64) ---Managed DLL (AnyCPU) --Unmanaged code (X64)
Managed exe 64 bit (IA64) ---Managed DLL (AnyCPU) --Unmanaged code
(IA64)
Managed exe 64 bit (x86) ---Managed DLL (AnyCPU) --Unmanaged code (X86)
are all ok, other combinations are not.

Willy.


"George" <Ge****@discussions.microsoft.comwrote in message
news:1B**********************************@microsof t.com...

Thanks Willy,

I have another DLL which reference this DLL, but the other DLL is native
unmanaged native code (C++), and it is not .Net based. How to build the C#
DLL in my case? Is *Any CPU* setting ok?
regards,
George

"Willy Denoyette [MVP]" wrote:

>"George" <Ge****@discussions.microsoft.comwrote in message
news:D9**********************************@microso ft.com...

Hello everyone,
I am using C# to develop DLL using Visual Studio 2005 and .Net 2.0, and
I
have no idea of how to make my DLL work with applications on 64-bit
platform.
Above all, I do not utilize any new features in my DLL of 64-bit. So, I
want
to check the general rules,


Check your Project Build Properties, the default Platform target option
is
set to *AnyCpu*, which mean that your DLL will run as a 64 bit when
loaded
in a 64 bit process and as 32 bit when loaded in a 32 bit process.

1. For C#, is there a need to make two separate builds (32-bit and
64-bit)
according to the application (32-bit or 64-bit) which uses the DLL?
i.e.
provide 64-bit application my 64-bit C# DLL, and provide 32-bit
application
runs on 64-bit platform my 32-bit DLL?


No, when building a DLL you better keep the default Platform as is
("AnyCpu").
When talking about an executable assembly things get a bit more
complicated.
If your application really needs the extended addressing range offered by
64bit Windows, then you have to build your exe as a 64 bit application
(Platform = X64 or IA64 depending on the platform), such application
cannot
run on X86 anyway.
However, if you don''t need the extended addressing capability AND you
don''t
need to run on IA64, then you better set the Platform to "X86". This way,
your appplication runs as 32 bit on all Windows platforms (IA32 and X64).

2. If we have to make two separate builds, how to do it in Visual
Studio
2005? I only find a setting names for Any CPU in project -->
properties.

You should have AnyCpu, X86, X64 and Itanium, what version of VS2005 are
you
running?

Willy.



这篇关于C#64位DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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