Question

The modules in my project are copied to a folder after build, and are imported via a DirectoryCatalog. However, because the module project is not referenced or instantiated anywhere in the main project, it doesn't automatically get built when I press F5 for a debug session, after making changes to it, so the same bug presents, until I go and explicitly build the module project itself.

I am looking for a way to automate the building of all module projects automatically before the main project is built. I would have to have a pre-build event and call the C# compiler for each of these projects, but that is where I get totally lost. How must I do that?

Was it helpful?

Solution

I am sure there are lots of ways you can do this, but the easiest and most painless way is to just reference the project (just be careful that you don't break the MEF by directly accessing objects from these projects). To ensure you get the latest build from those projects, you need to point the DirectoryCatalog path to the bin folder of the project referencing it. It's a shortcut but it works all the time. You can also explore adding some post-build events, but if you are sharing the code and is using a central repository with others, this could cause potential headache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top