Why does Visual Studio sometimes turn SAME pointer parameters in COM libraries into uint
and sometimes to ulong
? I have a COM library that has some methods with parameters such as
[ in ] ULONG_PTR ParentWindow
When I reference this library on my desktop computer, the interop assembly turns the ULONG_PTR
into uint
. When I do the same on my laptop, it is turned into ulong
. This causes problems when sharing the project between machines. I probably could store the Interop assembly in SVN together with rest of the project, but this causes problems if I ever need to regenerate it after updating the COM library for example.
The systems are:
Desktop Laptop - Windows Vista Professional 64-bit - Windows 7 Ultimate 64-bit - Visual Studio 2008 Professional - Visual Studio 2008 Team System (SP1) Development Edition (SP1) - .Net Framework 3.5 SP1 - .Net Framework 3.5 SP1
UAC is enabled and Visual Studio is run as administrator.
I'll try applying Visual Studio 2008 SP1 on the Laptop in case this has any effect.
Edit: Applied SP1 on laptop with no effect.
Update:
When adding the reference to the COM library in Visual Studio, Process Monitor shows devenv reading COMLibrary.dll on the desktop computer while it reads COMLibrary64.dll on laptop. This definitely is the reason why desktop shows uint for pointers while laptop shows ulong.
Now why does it do this? Devenv process on both computers is running under WoW64.
When running the program, it uses COMLibrary64.dll on both computers according to Process Monitor. So the problem seems to be only during the reference adding.
Will try to do the interop generation manually next.