I have a number of solutions. There is much overlap, so that code goes into another solution of "common" code, and I reference it as a DLL or git submodule.
But there's also lots of common JavaScript and CSS, and even some .config files and XML. I need to duplicate them for every solution!
How can I pull shared js/css into a solution? Keep in mind the shared assembly's DLL won't contain those static files.
Also, importantly, I need to be able to reference those js/css files in MVC's bundling system (that's the whole point, after all).
OK I found a way which works, is simple, self-contained - and does not need a local nuget server (which is overkill for something so simple, and I prefer less tools and less servers if I can help it).
Note: my common code, styles, scripts, everything are contained in a git submodule in my solution. If you don't work this way, just adapt the paths below to point to your shared stuff.
Add to pre-build event to delete all files (not required, but deletes files from destination which were deleted in the source):
Add to post-build event to copy files:
If using git, add those directories to
.gitignore
:Pros:
Cons: