I have a utils class library project that includes some Sharepoint functionality. The project references Microsoft.Sharepoint.dll
(copy local is set to false). We have many other projects that reference our utils dll and whenever we build them Microsoft.Sharepoint.Sandbox.dll
is copied to the bin folder of these apps. Then when running any of the apps I get the following error:
Could not load file or assembly 'Microsoft.Sharepoint.Sandbox' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Deleting the dll fixes the problem.. Is there a way to stop this Microsoft.Sharepoint.Sandbox.dll from being copied into the bin folder? I don't want to use post build scripts because there are many projects that reference the utils project and we will still have to manually delete the dll when deploying.
I can reproduce as follows:
1) Create a new solution
2) Add a class library project called utils
3) Reference Microsoft.Sharepoint.dll
4) Class1.cs:
namespace Utils
{
public class Class1
{
public void testMeth()
{
Microsoft.SharePoint.DefaultItemOpen c;
}
}
}
5) Add a new web project to the solution (WebApplication1)
6) Reference the Utils project and try to run WebApplication1
Edit: Microsoft.Sharepoint.Sandbox is a 64bit dll but I need to target Any CPU.
Is there no way to tell VS to stop pulling across implict references?