When working on a VS project that involves referencing Microsoft.SharePoint.dll, building the project causes Microsoft.SharePoint.Search.dll to be copied to my bin folder. Why is this? Okay, maybe it's just a bug, but I want to know the mechanism. (Thanks to SO, I know how to prevent this from happening, but I still want to find out why it happens in the first place.)
4 Answers
I believe this happens because Microsoft.SharePoint.dll uses it as a dependency. As Microsoft.SharePoint.Search.dll is not in the GAC, Visual Studio copies it to the bin folder.
- 57,008
- 17
- 43
- 79
- 5,961
- 9
- 49
- 89
-
OK so I just read the SO answers which say essentially the same thing. What is it that you're not clear on? – Alex Angas Oct 08 '09 at 19:58
-
Hmmm.. Microsoft.SharePoint.dll references a lot of other non-GAC assemblies (Microsoft.SharePoint.Security for example) but those don't get copied. Perhaps it is dragged in because a concrete constructor somewhere calls or can call something in the search.dll? – Hafthor Oct 08 '09 at 20:33
-
I just found it really odd because I've never seen this behavior any other time. – Hafthor Oct 08 '09 at 20:34
-
Have you checked if the other assemblies it references are already in the GAC? – Alex Angas Oct 08 '09 at 20:59
Alex is correct, if you want to stop this happening you can use this hack:
- Add a reference to
Microsoft.SharePoint.Search.dll(in the 12\ISAPI directory) - Select and in the Properties page set Copy Local = false
This makes it easier when you want to do post build events like coping DLL around.
- 57,008
- 17
- 43
- 79
- 626
- 5
- 8
-
Apologies - just saw the link to SO to explain how to stop this. I suppose it's useful here though as we build up our SPO (is that the right acronym?) – AndrewWoody Oct 09 '09 at 10:54
If it works for you, try putting a build event in your project. Right click the project in Solution Explorer, click Properties, and then go to the Build tab. In Post Build events, put the text:
cd $(ProjectDir) del bin\Microsoft.SharePoint.Search.dll del bin\Microsoft.SharePoint.Search.xml
This will delete the files after every build.
- 5,961
- 9
- 49
- 89
One of our customers experienced this problem and it appeared to be due to the Office Developers Tools for Visual Studio option available at the Individual Components section of the Visual Studio 2019 installation wizard, e.g.
The solution is to uncheck it and to uninstall the addon. Therefore, the SharePoint related assemblies should not be added to the project when compiling it.
- 111
- 3
