How to configure post-build events for installation and deployment projects in Visual Studio

My solution has two projects. One of them is my real project, and the other is the installation project.

In my real project, there is one report folder in which I store all ssrs reports. I have one folder in the installation project called "SSRS_Repor". Now I want, when I do the batch build, then re-create the settings for my project, and then I want to copy all the files from the report folder of my actual project to SSRS_Repor in my installation project.

If I can automate copying files from one place to another folder of my installation project, then I can get rid of manually copying rdls files. I heard that this is possible with installation / deployment projects. I searched on Google for detailed step-by-step instructions, but did not get any good links. So please explain to me how I can do this.

I also posted this on another forum, and someone told me about it below:

Open or create a setup/deployment project in Visual Studio 2005 Press F4 to display the Properties window Click on the name of your setup/deployment project in the Solution Explorer Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear Click on the "..." button to display the Post-build Event Command Line dialog Add a command line of your choice in the Post-build event command line text box Build your project in Visual Studio and verify that the post-build event is executed after the main MSI build 

So everything is fine, but what do I need to write to copy files from one place to another? This is not clear to me. Therefore, now for me the most important thing is what to write to copy the file during installation generation.

I got another hint as below. The script to configure the Pre / Post Build Event, but not in the know. I received the sample as

copy / Y "$ (TargetDir) $ (ProjectName) .dll" "$ (SolutionDir) lib \ $ (ProjectName) .dll"

The above statement or line is not clear to me. What do I need to write in my case? I need a step by step guide.

Here is a screenshot of my project structure

Enter image description here

+7
source share
1 answer

To answer your question simply:

The commands that you enter in assembly events (whether before or after) are the same as you type in the command line field.

In your example:

 copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)lib\$(ProjectName).dll" 

copy is a valid DOS copy command.

/ Y is a normal parameter that prohibits confirmation requests.

"$ (TargetDir) $ (ProjectName) .dll" is the source file to copy.

"$ (SolutionDir) lib \ $ (ProjectName) .dll" is the place where you want to copy the file.

You can contact here for more information on batch file commands: List of batch commands

$ ({Identifier}) are macros that can be used in the Visual Studio Pre / Post Build Event Designer.

You can refer to the MSDN online help for more information about macros: MSDN Macro List

The line provided to you will not do what you want. It is usually used to copy DLL files to the library folder used by some other projects or solutions.

The solution you found to create a new build event is the right one.

All you have to do is write down a command that will actually copy the files.

It will look something like this:

 XCOPY "$(SolutionDir)TestProject\Reports\*.*" "$(SolutionDir)TestSetup1\SSRS_Repor" /Q /E /I 

/ Q: Quiet | Do not display backup files

/ E: Recursive (copy subfolder structure and files)

/ I: assume that the destination is a folder if it does not already exist (if necessary, create a new folder)

+12
source

Source: https://habr.com/ru/post/926951/


All Articles