The custom section in my web.config file looks like:
<section name="management" type="Integration.CustomConfiguration.ManagementSection, Integration.CustomConfiguration" />
<management>The web project builds fine, however, when I attempt to build using a deployment project (so that I can do web.config file section replacements) I get the following error:
Error 34 An error occurred creating the configuration section handler for management: Could not load file or assembly 'Integration.CustomConfiguration' or one of its dependencies. The system cannot find the file specified. (C:\Documents and Settings\pmatic\Desktop\Management\Management.Web_deploy\Release\web.config line 24) C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets 613 9 Management.Web_deploy
I'd prefer to avoid the GAC,
Thanks in advance :)
I am having the same problem, is there no one who knows how to solve this?
I contacted Scott Guthrie and he asked Bradley Bartz to help me out who sent me this:
... the current implementation of the config section replacement task is using the Config API which relies on instantiating the types. Because the log4net.dll is in the bin the MSBuild task fails to load this type when running under msbuild.exe. One customer who had the same issue with log4net.dll worked around the problem by putting log4net.dll in the GAC.I know other customers who have implemented their own msbuild task to do a simple text replacement on the xml document.
Here is what another customer did for the specific issue:
Decided to work around this problem by using the configSource attribute to specify an external file for the log4net section, and then use msbuild to copy the correct config file from the deployment configs sub folder at build time
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<add key="Environment" value="Development" />
<compilation debug="false" />
<authentication mode="Windows" />
Hope this helps, Brad.
This should work for you. Good luck.
Thanks for sharing that workaround. Worked great for me!
I have found that in order for this to work when adding a custom configuration to the GAC, you must add the version number and public key to the web.config configuration section. See http://forums.asp.net/p/1003600/1327015.aspx. I believe I also read somewhere that adding the assembly dll to the Framework's executable directory (C:\WINNT\Microsoft.NET\Framework\v2.0.50727) also solves the issue.
I too have this problem :( it's very very very frustrating! Like the initial post in this thread, i seriously do NOT want to put something into the GAC or have to copy the .dll to the root .NET version folder. That's just poor :(
Finally, i didn't really understand what 'Mufasa245' said. Are there any ways we can check to see why the .dll is not getting located, when it tries to do the custom configuration replacement stuff?
it's soooo frustrating!
- Pure Krome -
In other words, the build can't find the DLL since it does not load the files in the Bin during config section replacement. So, putting it in the GAC solves that. If you don't want to do that, the other solution was to use an external configuration file (in other words, put the body section *not* in web.config but in a config file *referenced* by web.config) to configure log4net. Then, in a post-build task, copy over the production version of the external, log4net-only config file overwriting the original external, log4net-only config file. You see, copying files around is easy, if you know how. It was just in-file replacement was difficult and that's why WDP has that feature. But, if you use an external config file for a section, you can still just replace the whole file. To learn more, look up information on using external configuration files and how to customize the WDP build process. You edit the WDP XML file, which has some good example build tasks. ScottGu has a good post on his blog about configuring WDP that showed me how to do it.
I swear i tried adding the dll to the GAC and it didn't work. I eneded up having to put the dll into the same directory as the devenv.exe, close vs2005 and restart it.
now using the copy over file idea i think has serious merit! i might just look into that actually :) I tried reading all the stuff by the God, ScottyGu, but still had no luck. My component was a thing we bought called SlickUpload.
- Pure Krome -