In my project, I had a scenario to build the assembly program and after that, I had to perform few operation related to deployment since my project is kind of a connector to connect Microsoft Dynamics GP to an e-Commerce solution.
So, I was looking for a solution. I found out that my whole process can be executed with visual studio.Since my connector has one part of.Net assembly which is built with c#, I was using Visual Studio 2015 as my development environment.
Solution
In my case, I had to write a PowerShell script within my solution to automate copping file to necessary places. Refer this link if you need more information about How to write PowerShell script
once I have the script in place, we need to set the property Copy to Output Directory to Copy always to make this script copy always to the bin folder.
Then, In visual studio project in build event, I have given following command to run PowerShell script with the required parameter as the file path.
powershell.exe -file "$(ProjectDir)bin\Debug\ReleaseBuild\RegisterForMaualProcess.ps1
- Once you use powershell.exe it will execute powershell.exe.
- But you need to provide a file as a parameter. therefore -file has been used.
- In order to get the project execution path automatically, you have to use $(ProjectDir)bin.
- then rest of is the path to your PowerShell script.
Comments
Post a Comment