Closed exedor closed 2 months ago
Never mind. I figured it out. I am not entirely sure why, but the Visual Studio build process seems to create and delete the msi file twice. The first time creates the copy of the destination file. The second time, it already exists so the copy command fails. So the above code works fine if it includes this:
project.BuildMsi();
// Copy the compiled and built MSI into the appropriate folder
if (System.IO.File.Exists(FinalMSIDestFile))
System.IO.File.Delete(FinalMSIDestFile);
System.IO.File.Copy(FinalMSISourceFile, FinalMSIDestFile);
When I build my project (Debug or Release) it creates a single file in\.msi
I need to automate copying debug and release builds of the installation to each of their respective locations. I learned this happens at runtime, not compile time and the build process in the project does some tasks at run time. So, I added this at the bottom of the Main function:
So the build fails with this error message. What is the recommended way to take the default .msi file created in the project directory and copy it to another directory with a different filename after it's creation? I've already learned enough to know that the post-build event in the Visual Studio project isn't a good solution. I've also noticed the "publish" action just places all the files that get bundled into the msi into that location, not the msi itself. So all the normal ways I know of doing something like this, it seems, are not an option.