from the ‘geeks of the world, unite’ dept:
Arrgh. I’ve spent the last two days wrasslin’ with the idiosyncrasies of Sharepoint / MOSS 2007, trying to deploy the Microsoft Enterprise Library / Logging Application Block. I’d chosen the tool to “save time” (ha!) in developing a reusable logging tool, that can log to the EventLog, a flat file, a DB, etc etc … and it works great. But good luck trying to get it to work in a SmartPart or web part or user control in SharePoint.
Or, read on.
Basically you have to get SharePoint to see the assemblies. I’m using the Enterprise Library 3.1 (May 2007). So I installed the download on the SharePoint server (you may be able to just copy the assemblies you need, but what the heck). Then I copied the DLLs that the web controls reference from the Enterprise Library’s /bin folder into the GAC (you should know how to do this), making note of the PublicKeyToken, version numbers, etc.
The hairy part was figuring out what exactly needed to go into the SharePoint site’s web.config file (located in %wwwroot%/wss/VirtualDirectories/80). Here’s what I had to add, and where:
<configuration> <configSections> <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </configSections> <SharePoint> <SafeControls> <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Practices.EnterpriseLibrary.Common" TypeName="*" Safe="True" AllowRemoteDesigner="True" /> <SafeControl Assembly="Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Practices.EnterpriseLibrary.Logging" TypeName="*" Safe="True" AllowRemoteDesigner="True" /> <SafeControl Assembly="Microsoft.Practices.ObjectBuilder, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Practices.ObjectBuilder" TypeName="*" Safe="True" AllowRemoteDesigner="True" /> </SafeControls> </SharePoint> <system.web> <securityPolicy> <trustLevel name="WSS_Medium" policyFile="C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12configwss_mediumtrust.config" /> <trustLevel name="WSS_Minimal" policyFile="C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12configwss_minimaltrust.config" /> </securityPolicy> <compilation batch="false" debug="false"> <assemblies> <add assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </assemblies> </compilation> <trust level="WSS_Minimal" originUrl="" /> </system.web> <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="" logWarningsWhenNoCategoriesMatch="true"> {copy this from your VS.NET web.config} </loggingConfiguration></configuration>
Hope this helps you … please not that this is not a complete web.config, it’s just the new bits that need to be added.
After that, an iisreset, and things were kickin’. YMMV.





