cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

DTS CA call on a 64bit machine fails when the CA.dll is 32 bit

Hi.

Hope someone having some experience with Custom actions and DTF can explain some strange behavior I experience.

I am working on a custom action using DTF that calls methods in Microsoft.SharePoint.dll

Like string centralAdminUrl = SPAdministrationWebApplication.Local.GetResponseUri(SPUrlZone.Default).ToString();


When I’m trying to install my application on a x64 SharePoint server and my CA.dll is either compiled as x86 or ANY CPU the call to the Microsoft.SharePoint.dll fails with an “Object reference not set to an instance of an object exception” If the dll is compiled in x64 it works.

If I make an exe file that consumes my own x86 dll and make the same call on the same machine everything works like a charm. Nothing has changed except the call from the exe instead of the call from the msi.

It also works if I call the exe file from my msi.

I can see two solutions for this problem. 1. Make two installers just to be able to run some SharePoint commands (My installer contains a wsp file and some xml files) 2. Make one installer but add both a x64 and a x86 version of the dll and call the right one according to the OS.

Can anyone tell me why this happens and whatever there are a workaround where I don’t make the installer more complex than necessary.

Best regards,
Jens
Labels (1)
0 Kudos
(1) Reply
Christopher_Pai
Level 16

While DTF integrates with InstallShield nicely, it really isn't a Flexera technology that they support. You'll get better answers over on the wix-users mailing list. I have done a bit of DTF work though so I'll try to think through this problem.

I'm a little puzzled because if the CA is compiled as Any CPU it should jit up as a 64bit process on an x64 machine. You say if you compile it as x64 it works so I'm trying to think of why the results are different.

If I was trying to get a quick solution until I had time to fully understand the problem, I'd factor your code into it's own library project and write the two CA projects both referencing the reused library. Build one as x86 and one as x64 and wire them into InstallShield with mutually exclusive conditions based on the VersionNT64 property.

Until then, I'll be thinking about this one on some off cycles.
0 Kudos