Home » Custom Writing » Visual studio custom build step copywriting

Visual studio custom build step copywriting

Visual studio custom build step copywriting will just perform the copy

I wish to produce a Visual Studio (I’m using VSTS 2008) project that does file copy work, in additional details, I’ll then add files for this project which project copy files (incorporated within this project) with a destination location after i build the work.

Any ideas how to get this done in VSTS?

BTW: I heard using proj file could do such types of task, but I haven’t found worthwhile easy to learn samples for beginner. -)

thanks ahead of time, George

Another solutions for this question have a tendency to assume you aren’t using VisualStudio but MSBuild directly and have a current project that you can also add a custom build step or perhaps a build event (I’ve discovered build event kind of solutions error prone because they’re not going to always copy the files when you really need them copied).

If you prefer a VisualStudio project that just will a copy, this can be done having a stock VisualStudio having a Makefile project.

The marginally misnamed Makefile project can perform anything that you can do in the command line. Clearly which means you can produce a Makefile project that just copies files. Inside a Makefile project’s Qualities ⇒Configuration Qualities ⇒NMake section are fields for Build, Rebuild, and Clean actions. These may be populated with common batch file instructions. On every build, VisualStudio can create a brief batch file in the proper field and carry it out with cmd. Warning you’re going to get the 32-bit cmd interpreter on 64-bit machines so you will have to make use of the magical sysnative directory if you would like access 64-bit home windows instructions or DLLs (I am unsure if this sounds like documented anywhere so it might not continually be the situation – your batch scripts ought to be robust from the bit-liness of cmd altering.

Example batch code requiring 64-bit system files not understanding in advance what cmd or OS (32-bit or 64-bit) will run the code:

Visual studio custom build step copywriting Example batch code requiring 64

(thie “copy foobar” line above will fail resulting in the build to fail.)

Note, VisualStudio (and MSBuild) will invariably operate a Makefile project – it doesn’t look into the timestamp around the output file but rather punts that job as to the it expects to become another build tool (nmake, cmake, make, ant, maven, etc.). Since, within this situation there’s only a simple copy command and never some program checking if you should carry out the copy, the copy occurs on every build.

VisualStudio always running makefile projects does mean that any time you press F5 to debug any project, VisualStudio will annoy you having a poorly worded appear a dialog box (there are told it to not) suggesting that you simply any project has run out of date and you must construct it again. Should you tell VisualStudio to not display the dialog, it’ll just carry out the copy without asking before you run the executable.

clarified March 11 ’12 at 16:40


Share this:
custom writing low cost
Order custom writing

ads