How to get Visual Studio build process to create a distributable directory? -


i customize visual studio solution build automatically create directory tree dist -> bin directories. bin directory should have binaries automatically copied it.

note: solution has many projects not want customize project build, should on solution level.

i have tried 2 solutions:

1) modify each project file create dist directory tree if not exists. seems redundant me required modify project file each new project added solution.

2) created solution .targets files use msbuild.exe through command line. worked wanted prefer solution works within visual studio.

if cares, motivation have easy way distribute new builds without having extract source them every time.

update: 5/26/15

i wanted post solution here people same issue have solution. ended creating importbefore directory in same directory solution file. in same directory solution there directory each project contained in solution. standard structure visual studio solution , structure important msbuild has reference variable each project.

place file following content in $(msbuildextensionspath)\$(msbuildtoolsversion)\$(msbuildthisfile)\importbefore\

on machine @ c:\program files (x86)\msbuild\12.0\microsoft.common.targets\importbefore

my file "importbefore.targets" looks this:

<?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <propertygroup>     <importpath condition="'$(importpath)'==''">$(msbuildprojectdirectory)\..\importbefore</importpath>   </propertygroup>    <import project="$(importpath)\*" condition="'$(importbywildcardbeforemicrosoftcsharptargets)' == 'true' , exists('$(importpath)')"/>  </project> 

to test working added following target file \importbefore or on computer c:\users\admin\dropbox\projects\buildtestproject\importbefore

<?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <target name="onlyifexists" beforetargets="build" condition="exists('$(importpath)')">     <message text="found import directory '$(importpath)'" importance="high" />   </target> </project> 

in end update project file local solution create distribution directory if not created , copy binaries current project being built distributable directory.

there additional setup required, once have setup, works solutions\projects.

if @ microsoft.common.targets (found in c:\windows\microsoft.net\framework(msbuildversion)) see tries import number of custom targets files. can place own targets file in $(msbuildextensionspath)\$(msbuildtoolsversion)\$(msbuildthisfile)\importbefore\ folder or can create custom.before.microsoft.common.targets file in $(msbuildextensionspath)\v$(msbuildtoolsversion) folder. in custom extension can add import of $(solutiondir)solution.targets has custom copy command. since microsoft.common.targets file used in both c# , c++ compiles, custom targets loaded project types. long set these files on pc's use, should ok.

another option create {your project name , extension}.user file custom commands. solution not require modification msbuild folders, require each project have own file. said each .user file load $(solutiondir)\common.targets file had copy commands in it.

in case, @ microsoft.common.targets file see doing. if @ csproj file in text editor can see importing microsoft.common.targets. better understand msbuild process around.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -