when publish asp.net web application in visual studio 2012/2013/2015, visual studio publish packages.config (from nuget) , *.edmx.diagram files (from entity framework), default.
i know can go project , individually switch properties these files build action content build action none, however, have each project use entity framework, or other nuget-provided package.
i can configure publishing process exclude files on project-by-project basis, possible tell visual studio 2012/2013/2015 globally exclude these files, across projects?
you can exclude files extension or filename modifying properties in web.config file. @ documentation buildproviders element in web.config. can add extension , map system.web.compilation.forcecopybuildprovider, or add filename , use system.web.compilation.ignorefilebuildprovider
the buildproviders section has following structure:
<buildproviders> <add /> <clear/> <remove /> </buildproviders> you can exclude files or folders modifying project file. within propertygroup element, can add excludefilesfromdeployment , excludefoldersfromdeployment elements exclude desired items.
<propertygroup condition=" '$(configuration)|$(platform)' == 'debug|anycpu' "> <excludefilesfromdeployment>file1.aspx;file2.aspx</excludefilesfromdeployment> <excludefoldersfromdeployment>folder1;folder2</excludefoldersfromdeployment> </propertygroup> see answers question more details: exclude files web site publish in visual studio
update: in answer revised requirement able globally, across projects , solutions, i'd suggest create build target file import project files. within target file, can identify file , folder exclusions want make.
to make easier deliver build target of solutions, create nuget package contains target file , modifies .csproj files accordingly.
this approach used slowcheetah extend web.config transform process other .config files; nuget package delivers custom .targets file extends build process.
the initial setup effort, if you're supporting lot of solutions or teams, might best approach.
Comments
Post a Comment