How do I debug a custom module?

Topics: Troubleshooting
Feb 3, 2012 at 1:23 AM

Hi all, I'm new to orchard, so i've downloaded the source and i'm currently running it in VS2010.  I created a webiste to work through the hello world module tutorial; now for the daft question.

How do you debug a custom module in orchard, as in, have placed breakpoints trigger? 

I tried adding my existing hello world module from Orchard.Web into that projects module folder to VS, then it wont compile etc. and I know it's the wrong thing to do.  So again, how do I debug my module. Thanks

Feb 3, 2012 at 1:34 AM

Adding your module to the Orchard.Web\Modules folder should work. I assume by that you mean you opened the Orchard.sln, right clicked the Solution -> Modules folder, and did Add->Existing Project, and then selected your module's .csproj file .

What error(s) are you getting when you try to compile?

Feb 3, 2012 at 2:50 AM

Thanks for the reply Monarch: Yes to above, but when I was trying to ascertain why I couldnt, i included the modules folder in the Orchard.Web project [and included just my module] and got a multitude of complie errors all along the lines of Duplicate 'AssemblyTitle' attribute etc. etc.  I've seen in the forum that you shouldn't include modules here, but work with them in the solution -> modules folder instead [where the command 'codegen module <insert module name here>' installs them to]...which is where I cant seem to debug anything?  Any thoughts, I feel really silly that I can debug? Thanks

Feb 5, 2012 at 9:40 PM

Hey guys, can anyone thow me a bone? Thanks

Feb 5, 2012 at 10:39 PM

Not sure what youa re doing wrong. 

You should start from scratch with a fresh copy of the orchard code. Make sure you can compile that, and then run it from Visual Studio using F5 or Ctrl+F5. Once you can do that, then add your module to the src/Orchard.Web/Modules/ folder (by simply doing the codegen command to create the module). Then add the module to the solution by right clicking the "Modules" folder from within the solution -> Add Existing Project -> browse to your module's csproj (e.g.  /src/orchard.web/modules/<your_module>.csproj). 

Once you do that you should be able to compile and run the solution again.