Running integration tests (unit tests) from VS 2008 with WSS Vista install on x64

rated by 0 users
This post has 6 Replies | 3 Followers

Not Ranked
Posts 2
Points 44
mads.nissen Posted: Mon, Jan 19 2009 10:11 AM

Hi!

I've installed the package on vista and all seems to be working ok from a usage perspective. However when I try to run integration tests against the SP APIs it fails on the SPSite instantiation:

System.IO.FileNotFoundException: The Web application at http://localhost/ could not be found.

This is most likely related to VS running in 32 bit mode - because when I run the same test assembly from a x64 testrunner (not inside VS) the code is able to connect to sharepoint and run tests.

Has anyone found a way to run such tests within Visual Studio?

mads

Top 10 Contributor
Posts 511
Points 14,343

Mads,

Yes, unfortunately you can't access the OM from a 32bit process if you have the x64 version of WSS. This is because SPRequest is an unmanaged COM object and you can't mix 32 and 64 bit dll's. (So this has nothing to do with Vista)

That's why MS created the WebService in the new CTP of Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.3 so they can bridge the x86 - x64 gap.

 

/Jonas

 

Not Ranked
Posts 2
Points 44

As I suspected then:)

Thanks for the quick reply anyway Jonas. I'll make due with the testrunner hanging around on my secondary screen and wait for MS to release a x64 Visual Studio build:)

mads

ps: have you seen how the quickreply forum-feature behaves in firefox? window just grows and grows:)

Not Ranked
Posts 1
Points 22
jarofkla replied on Wed, Mar 18 2009 9:47 AM

Jonas,

What do you mean about the VS 2008 1.3 extensions' WebService?  I am trying to test SharePoint code out of context and I'm getting the same error as described above.  Is there a practical example of code "bridging the gap between 32 and 64bit?  I really want to unit test my code, but this gap is hindering me.

Thanks,

Randy

Top 10 Contributor
Posts 511
Points 14,343

Randy,

You must host your unit tests in a 64 bit process if you are targeting a 64bit WSS/MOSS. I use NUnit and Testdriven.NET which works great!!

The WebService introduced in the latest VS extensions helps MS to "bridge the 32/64bit process gap", so they can deploy/retract + more.

It won't do you any good for unit testing.

Thanks

/Jonas

 

 

Not Ranked
Posts 2
Points 27

Any quick tips on how to make nUnit run as x64? I dl'ed the nUnit package and made references in my project but I still get the SPSite constructor error. Am I skipping an important step on forcing it to be x64?

Top 10 Contributor
Posts 511
Points 14,343

Wartickler,

Make sure your Platform target is set to Any CPY (under Build settings).

If it is set to Any CPU try to set it to x64. You shouldn't have to but you can try it.

Thanks

/Jonas

Page 1 of 1 (7 items) | RSS
Bamboo Solutions Corporation, 2002-2014