سؤال

I'm trying to implement ELMAH in my MVC project. I've made my way through quite a few tutorials and have everything set up correctly.

My issue arises when I attempt to add the elmah.dll to my ThirdPartyLibs folder (where I store all of my .dll files). I downloaded the file and extracted it to my downloads folder. I Add -> Existing, and navigate to the .dll and it states:

"You are attempting to add an item to a source-controlled project, but the item's path has no mapping. If you continue with the add, this item will not be added to source control. Do you wish to proceed with the add?"

I then add it and my project is failing on the elmah portion of the following code:

Line 71:     <httpModules>
Line 72:       <add name="Glimpse" type="Glimpse.Core.Module" />
Line 73:       <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
Line 74:     </httpModules>
Line 75:     <httpHandlers>

I'm not sure what I'm doing wrong, as most of the articles assume you know your way around MVC, Visual Studio and can reference .dlls.

هل كانت مفيدة؟

المحلول

Judging from the error message you are getting it seems that you are using some source control under Visual Studio such as Team Foundation Server. Your project is source controlled and you have placed the Elmah.dll assembly in a folder outside of the location of the project which is under source control.

So for example your source controlled project is mapped to c:\myproject and you have extracted the elmah assembly into c:\elmah and have referenced it from this location. The problem with this approach is that the source control will no longer be aware of the location of this dependent assembly.

So one possibility to solve this problem is to add the dependent assembly under source control into the same folder: for example c:\myproject\Reference Assemblies\Elmah and then reference it from there.

Or simply use the official NuGet package.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top