sorin
sorin

Reputation: 170330

How to tell Visual Studio or to pickup a file and deploy it to the bin directory after build?

I do have few config files and dll files that are needed in order to run the final product and I want to instruct visual studio build to pick them up.

So far it was easy to add them to the project but I wasn't able to identify the correct mix of properties that I need to setup for these files, in order to get the files inside the bin directory (target).

Note: the term deploy here doed not refer to the after build deployment, that would be a custom task anyway.

So far I see these options:

Upvotes: 0

Views: 118

Answers (1)

Steve
Steve

Reputation: 216243

Select the project that requires the configuration file and right click on it and then select Properties.
Go to the Build Events tab and type in the Post-Build event command line something like the following

copy pathfiletocopy $(ProjectDir)$(OutDir)

now you could check the Copy Only on Successful Build option.

Of course you need to adapt the command line to your liking.
You can also press the button Edit Post-build and see a list of predefined macros that refers to specific informations related to your projects and solution. You could also insert other CMD shell commands like IF $(ConfigurationName) == "Release" to execute commands only when you compile for release instead of debug (for example running an obfuscator)

Upvotes: 1

Related Questions