Dllimport fails design time behavoir of other components
Dllimport fails design time behavoir of other components
I am developing a CF project targeted for a smart device. Since I need to interact with native code compiled into a dll, one of my CF classes uses the Dll-import attribute. Since the targeted environment differs from my developing environment, I only make use of the dll functionality at run time, not design time. I declare the dll methods I am using as static extern functons in the global scope of my CF component. Though, having this Dll-import statement makes this component and all other components in the same project fail to run in design time, however they all will run in run time. I tried to put the Dll I am going to use on several different locations on the computer I am developing on (however, it makes no sence to use it on my developing computer since the Dll is targeted for another device). Is there a special location I need to put the Dll on Or can I condition my Dll-import attribute so it only will be intrepreted in run time since I need my design time code to run Excluding the Dll-import attribute makes the design time constructor run. I am using VS2005.
namespace
CCSystems.PetWinCE
{
public class CTCanOpen : System.ComponentModel.Component, System.ComponentModel.IListSource
{ [
DllImport("CCCanOpen.dll")]
public static extern void SetUnmanagedIntSignal(int source, int signalValue);
public CTCanOpen(System.ComponentModel.IContainer container)
{
///
/// This constructor will not run in design time
///
...
} public CTCanOpen()
{
///
/// This constructor will run in run time
///
...
}
...
Dllimport fails design time behavoir of other components
Doctor Steve
#If DEBUG Then
'Do nothing
#Else
[DllImport("CCCanOpen.dll")]
#End If
or you can test if you are running Debug or Release configuration...
#If CONFIG = "Debug" Then
'Do nothing
#Else
[DllImport("CCCanOpen.dll")]
#End If
see here....
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbcn7/html/vacondeclaringconditionalcompilationconstants.asp
jsmircic
piaskal
See DesktopCompatible. Previous threads on the topic should help you:
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/search group=microsoft.public.dotnet.framework.compactframework&q=desktopcompatible&qt_g=1&searchnow=Search+this+group
Cheers
Daniel