I have an ASP.NET MVC solution, and I have a large number of HtmlHelper classes inside the ASP.NET MVC project that take data and generate various snippets of html to display on various pages.
I now have to run a bunch of scheduled jobs and many of those jobs generate emails. I moved all of these jobs into a separate project in the solution (called AdminJob.csproj), but I now find that I have to generate a number of email with very similar HTML as I have in my view pages. I am trying to keep the admin jobs from having a dependency on the ASP.NET MVC project (as I would like to run the adminjob project as a command line if required), and I also want to avoid having my ASP.NET MVC project having a dependency on the AdminJob project (as that just seems odd).
Any suggestions on how I can avoid duplicating the same HTML rendering code in both my ASP.NET MVC project and my AdminJob project?
The only thing I can think about is creating another project in the solution called "ViewHelpers" or something like that and move all of my HTMLHelpers into that project so it can be referenced by both my MVC project and the AdminJob project. It seems a bit overkill to have a separate project just for this code, but I can't think of another solution that doesn't create duplication.
Any other suggestions for a better way to do this and avoid any duplication?