A Before File Copy Action is a custom action that is ran before every singel file that is copied. It allows the custom funcitonality to be done to each file before it is copied and decide whther it should be copied at all.

Getting Started

  1. First Create a new Visual Studio project. Add the following reference your project CartellaInstallerCommon.

  2. Create a new class and use CartellaInstallerCommon.

  3. Derive your class from the interface ICustomUpgradeFileAction.

ICustomUpgradeFileAction Reference

OnBeforeFileCopy: This returns whether the file should be copied. You are given a Stream to the file that is going to be copied, a string that specifies the location to be copied to, and a boolean specfiying whether it should overwrite the file if it already exists.

Code Example

Here is a fully functional example.

CopyC#
public class FileCopyActionTest : ICustomUpgradeFileAction
{
    public bool OnBeforeFileCopy(Stream oldStream, string newLoc, bool overWrite)
    {

        System.Windows.Forms.MessageBox.Show("File Copy Action Test");
        return true;
    }
}