Bin Deploying Linked Files
Enable web publishing of linked files in _bin_deployableAssemblies
If like me you don’t want to have duplicate copies of your bin dependencies between your libraries/packages folder and
\_bin\_deployableAssemblies you’ll want to link them; unfortunately the default
Microsoft.WebApplication.targets won’t publish them – absurd I know!
Through experimentation I’ve found the most elegant solution is to have have a custom targets files (checked into source control and branched from a common location) that I import into my web projects.
It simply overrides one of the targets in
Microsoft.WebApplication.targets and copies linked files to a bin sub-folder before adding them to the CreateItem collection that is later used when building/publishing.
1 2 3 4 5 6 7 8 9 10 11 12
Then in my web .csproj project file add an import link to the new targets file;
Important! Make sure you put this after the Import to
There seems to be a myth that
\_bin\_deployableAssemblies is MVC3 only which of course is utter tosh, this works for any project that uses Microsoft.WebApplication.targets; I know this as we use it in our FubuMVC projects to copy Simple.Data MEF dependencies :–)