tags:

views:

1526

answers:

4

I am developing on a 64bit version of Windows 7, running MOSS (SharePoint), this is my dev machine.

Now when I deploy my web service app to a test server Windows 2003 32bit (no Sharepoint installed) I get this error.

Could not load file or assembly 'Microsoft.SharePoint.Library, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified

The DLL has clearly been copied to the bin directory (Microsoft.Sharepoint.dll).

Any ideas?

A: 

Don't mix 64-bit and 32-bit for dev / testing / production. This will never work reliably if at all.

Chris Ballance
+1 for this point, because in SharePoint you want to try minimize environment differences, but ofc in traditional .net development in my experience its not a huge problem because you can output using the ANY CPU build model.
JL
@Chris: I've been doing this for almost a year with web parts, event receivers, etc... What problems have you found?
Alex Angas
A: 

Well what about other dlls referenced by the Sharepoint dll? With long dependency chains it can be quite difficult to diagnose these sort of problems. In such situations I find the fusion log viewer extremely useful. It is a part of framework SDK - open the SDK Command prompt and type fuslogvw. It is pretty obvious from there

mfeingold
+3  A: 

If you are using sharepoint dll's it will only work on a machine with sharepoint installed.

Even if you managed to hack it and get it to work, you would probably be breaking a license agreement.

Shiraz Bhaiji
How sure are you of this?
JL
@JL: I would guess *pretty darn sure*. SharePoint isn't exactly freeware and I can't imagine that MS would appreciate bits of it being broken out for use in another app.
Chris Lively
Most of Sharepoint that people actually use is just WSS. Comes free with a windows server license.
Chris Ballance
@Chris, Yes but then you would install WSS, not just copy in a dll
Shiraz Bhaiji
+1  A: 

This is almost certainly a dependency issue. The DLL is dependent on another DLL which isn't in the GAC or on the probing path. The two tools you need to figure this out are FUSLOGVW.EXE and Process Monitor

Fusion Log viewer will allow you to look at assembly bind successes and failures as your application loads. It's part of the Windows SDK.

http://msdn.microsoft.com/en-us/library/e74a18c4%28VS.71%29.aspx

FUSLOGVW needs admin privs to run correctly.

If that doesn't work another tactic is to use Process monitor to look at which files aren't getting loaded and which folders are being searched.

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

However. Without SharePoint installed I wouldn't expect this to work.

Ade

Ade Miller
+1 for the new knowledge of this tool. But I think the issue here, as you suspect too, is that MOSS has to be installed
JL