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):
rd /S /Q "$(ProjectDir)Scripts\include"
rd /S /Q "$(ProjectDir)Styles\include"
md "$(ProjectDir)Scripts\include"
md "$(ProjectDir)Styles\include"
Add to post-build event to copy files:
xcopy /D /S /F /Y $(SolutionDir)gitsubmodulename\projectname\Styles\*.min.css $(ProjectDir)Styles\include
xcopy /D /S /F /Y $(SolutionDir)gitsubmodulename\projectname\Scripts\*.js $(ProjectDir)Scripts\include
If using git, add those directories to .gitignore:
/*/Scripts/include/
/*/Styles/include/
Pros:
- At every build, new/changed files are pulled into your web project
- Since they are placed within the scripts/styles directories, they can be served in both debug and release modes
- Bundling works exactly as you'd expect. To deploy, just do a regular bin deployment
- You can make changes to the source files (in the git submodule, not the web project), and build, and the changes are available immediately (no need to edit, repack, update, etc. nuget packages)
Cons: