Is there a way for my ASP.net application to find out if it works in SharePoint (2010), but without referring to the SharePoint builds? (Therefore, I cannot just check if SPContext.Current is null).
I wonder if it is possible to get all the assemblies that are loaded by name? Therefore, if I see that my AppDomain contains a Microsoft.SharePoint assembly, I know that I am in SharePoint.
Use case. The assembly is done outside of SharePoint, but linking to the SharePoint DLLs requires deploying them (possibly due to licensing) or getting exceptions when accessing the SharePoint method.
I am currently using conditional compilation, but I would like to get away from it and use the DI mechanism to select one of the two classes, depending on whether I am in SharePoint.
source share