none
Creating .msp using Visual Studio Install and Deployment RRS feed

  • Question

  • Hi,

    I have created an MSI using Visual Studio 2010 + Install and Deployment Project.

    Now I need to create an upgrade for the original MSI.

    Please do help me.

    Regards,

    Vijay

    Tuesday, April 5, 2011 8:53 AM

Answers

  • Hi Vijay Chander,

    You can reference the following steps to create your patch.

     

    This procedure creates patch.msp files which contain the differences between the VS.NET deployment project current Release and Debug installers and the original installers you will place in a TargetImages folder. It requires that the VS.NET deployment project build properties be set to Package files=In setup file.

    1. Install the Microsoft Platform SDK.
    2. Install Orca.Msi located at C:\Program Files\Microsoft Platform SDK\Bin\.
    3. Copy TEMPLATE.PCP located at C:\Program Files\Microsoft Platform SDK\Samples\SysMgmt\Msi\Patching\ to your deployment project folder and rename it to patch.pcp.
    4. Double click the patch.pcp file to open it in ORCA.
    5. Add a record to the ImageFamilies table and set Family to fam1.
    6. Add a record to the PatchSequence table and set PatchFamily to fam1 and Sequence to 1.0.0.
    7. In the Properties table, select the value for PatchGUID and right click it. Select paste new GUID.
    8. In the Properties table, select the value for PatchOutputPath and set its value to Patch\patch.msp.
    9. Add a record to the Properties table and set its name to MinimumRequiredMsiVersion and its value to 200.
    10. Add a record to the TargetImages table and set these values: Target=target, MsiPath=TargetImage\setup.msi, Upgraded=upgrade, Order=1, IgnoreMissingSrcFiles=0.
    11. Add a record to the UpgradedImages table and set these values: Upgraded=upgrade, MsiPath=UpgradedImage\setup.msi, Family=fam1.
    12. Create a TargetImage\Release folder in your deployment project folder and copy the installer MSI of your first release install into it.
    13. Create a TargetImage\Debug folder in your deployment project folder and copy the installer MSI of your first debug install into it. If you do not create and distribute debug installs you can skip this step.
    14. Create a new patch.cmd file in your deployment project folder and add the following commands to it:
       Collapse
      if "%1"=="" %0 Debug Release Done 
      
      @SETLOCAL 
      @set path=%path%;"C:\Program Files\Microsoft Platform 
            SDK\Samples\SysMgmt\Msi\Patching"
      @set PatchTmp=C:\~VSTMP 
      
      :loop 
      if "%1"=="Done" goto end 
      
      if not exist %1\*.msi goto nopatch 
      if not exist TargetImage\%1\*.msi goto nopatch 
      
      :ok 
      rmdir /s /q %PatchTmp% 
      mkdir %PatchTmp% 
      mkdir %PatchTmp%\TargetImage 
      mkdir %PatchTmp%\UpgradedImage 
      mkdir %PatchTmp%\Patch 
      
      for %%a in (TargetImage\%1\*.msi) do copy %%a %PatchTmp%\setup.msi 
      msiexec /qb /a %PatchTmp%\setup.msi TARGETDIR=%PatchTmp%\TargetImage 
               /L*v %PatchTmp%\TargetImage\setup.log 
      del %PatchTmp%\setup.msi 
      
      for %%a in (%1\*.msi) do copy %%a %PatchTmp%\setup.msi 
      msiexec /qb /a %PatchTmp%\setup.msi TARGETDIR=%PatchTmp%\UpgradedImage 
              /L*v %PatchTmp%\UpgradedImage\setup.log 
      del %PatchTmp%\setup.msi 
      
      copy patch.pcp %PatchTmp% 
      set PatchDir=%CD% 
      chdir %PatchTmp% 
      msimsp -s patch.pcp -p Patch\patch.msp -l Patch\patch.log 
                  -f %PatchTmp%\Tmp -d 
      
      rmdir /s /q %PatchTmp%\TargetImage 
      rmdir /s /q %PatchTmp%\UpgradedImage 
      rmdir /s /q %PatchTmp%\Tmp 
      chdir %PatchDir% 
      
      mkdir Patch 
      mkdir Patch\%1 
      copy %PatchTmp%\Patch\*.* Patch\%1\*.* 
      rmdir /s /q %PatchTmp% 
      
      :nopatch 
      shift 
      goto loop 
      
      :end 
      pause
    15. Edit your deployment project and change the version property. This is required so that the patch compiler (msimsp.exe ) sees a different version.Important: When it asks to update the ProductCode and PackageCode, you must answer NoPackageCode is a hidden property which VS.NET automatically updates each time you build the deployment project; but, ProductCode must not be changed for the patch compiler to work. The patch compiler will refuse to create working patches of major upgrades and it determines this by the ProductCode being changed, not by the Version number.
    16. Build your deployment project. If you use both Debug and Release configurations be sure to build both of them. The fact that theUpgradeCode and ProductCode have not changed, and the hidden PackageCode has changed will indicate to patch compiler that the updated version is a minor update instead of a major upgrade.
    17. Run the patch.cmd batch program. This process can take several minutes to complete depending upon the size and complexity of your original deployment projects. The patch compiler will compare each file in both setup projects to determine which files have changed and either create a delta between the files, or include the whole file if there are too many changes. Be sure to check the patch.log files to see what files were included in your patch and to be sure everything compiled correctly with no errors.

     

    http://www.codeproject.com/KB/install/dotnetpatching.aspx?fid=209224&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2567089

    http://msdn.microsoft.com/en-us/library/aa370578(VS.85).aspx

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Vijay Chander Wednesday, April 13, 2011 6:24 AM
    Thursday, April 7, 2011 4:06 PM
    Moderator

All replies

  • Hi Vijay Chander,

    You can reference the following steps to create your patch.

     

    This procedure creates patch.msp files which contain the differences between the VS.NET deployment project current Release and Debug installers and the original installers you will place in a TargetImages folder. It requires that the VS.NET deployment project build properties be set to Package files=In setup file.

    1. Install the Microsoft Platform SDK.
    2. Install Orca.Msi located at C:\Program Files\Microsoft Platform SDK\Bin\.
    3. Copy TEMPLATE.PCP located at C:\Program Files\Microsoft Platform SDK\Samples\SysMgmt\Msi\Patching\ to your deployment project folder and rename it to patch.pcp.
    4. Double click the patch.pcp file to open it in ORCA.
    5. Add a record to the ImageFamilies table and set Family to fam1.
    6. Add a record to the PatchSequence table and set PatchFamily to fam1 and Sequence to 1.0.0.
    7. In the Properties table, select the value for PatchGUID and right click it. Select paste new GUID.
    8. In the Properties table, select the value for PatchOutputPath and set its value to Patch\patch.msp.
    9. Add a record to the Properties table and set its name to MinimumRequiredMsiVersion and its value to 200.
    10. Add a record to the TargetImages table and set these values: Target=target, MsiPath=TargetImage\setup.msi, Upgraded=upgrade, Order=1, IgnoreMissingSrcFiles=0.
    11. Add a record to the UpgradedImages table and set these values: Upgraded=upgrade, MsiPath=UpgradedImage\setup.msi, Family=fam1.
    12. Create a TargetImage\Release folder in your deployment project folder and copy the installer MSI of your first release install into it.
    13. Create a TargetImage\Debug folder in your deployment project folder and copy the installer MSI of your first debug install into it. If you do not create and distribute debug installs you can skip this step.
    14. Create a new patch.cmd file in your deployment project folder and add the following commands to it:
       Collapse
      if "%1"=="" %0 Debug Release Done 
      
      @SETLOCAL 
      @set path=%path%;"C:\Program Files\Microsoft Platform 
            SDK\Samples\SysMgmt\Msi\Patching"
      @set PatchTmp=C:\~VSTMP 
      
      :loop 
      if "%1"=="Done" goto end 
      
      if not exist %1\*.msi goto nopatch 
      if not exist TargetImage\%1\*.msi goto nopatch 
      
      :ok 
      rmdir /s /q %PatchTmp% 
      mkdir %PatchTmp% 
      mkdir %PatchTmp%\TargetImage 
      mkdir %PatchTmp%\UpgradedImage 
      mkdir %PatchTmp%\Patch 
      
      for %%a in (TargetImage\%1\*.msi) do copy %%a %PatchTmp%\setup.msi 
      msiexec /qb /a %PatchTmp%\setup.msi TARGETDIR=%PatchTmp%\TargetImage 
               /L*v %PatchTmp%\TargetImage\setup.log 
      del %PatchTmp%\setup.msi 
      
      for %%a in (%1\*.msi) do copy %%a %PatchTmp%\setup.msi 
      msiexec /qb /a %PatchTmp%\setup.msi TARGETDIR=%PatchTmp%\UpgradedImage 
              /L*v %PatchTmp%\UpgradedImage\setup.log 
      del %PatchTmp%\setup.msi 
      
      copy patch.pcp %PatchTmp% 
      set PatchDir=%CD% 
      chdir %PatchTmp% 
      msimsp -s patch.pcp -p Patch\patch.msp -l Patch\patch.log 
                  -f %PatchTmp%\Tmp -d 
      
      rmdir /s /q %PatchTmp%\TargetImage 
      rmdir /s /q %PatchTmp%\UpgradedImage 
      rmdir /s /q %PatchTmp%\Tmp 
      chdir %PatchDir% 
      
      mkdir Patch 
      mkdir Patch\%1 
      copy %PatchTmp%\Patch\*.* Patch\%1\*.* 
      rmdir /s /q %PatchTmp% 
      
      :nopatch 
      shift 
      goto loop 
      
      :end 
      pause
    15. Edit your deployment project and change the version property. This is required so that the patch compiler (msimsp.exe ) sees a different version.Important: When it asks to update the ProductCode and PackageCode, you must answer NoPackageCode is a hidden property which VS.NET automatically updates each time you build the deployment project; but, ProductCode must not be changed for the patch compiler to work. The patch compiler will refuse to create working patches of major upgrades and it determines this by the ProductCode being changed, not by the Version number.
    16. Build your deployment project. If you use both Debug and Release configurations be sure to build both of them. The fact that theUpgradeCode and ProductCode have not changed, and the hidden PackageCode has changed will indicate to patch compiler that the updated version is a minor update instead of a major upgrade.
    17. Run the patch.cmd batch program. This process can take several minutes to complete depending upon the size and complexity of your original deployment projects. The patch compiler will compare each file in both setup projects to determine which files have changed and either create a delta between the files, or include the whole file if there are too many changes. Be sure to check the patch.log files to see what files were included in your patch and to be sure everything compiled correctly with no errors.

     

    http://www.codeproject.com/KB/install/dotnetpatching.aspx?fid=209224&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2567089

    http://msdn.microsoft.com/en-us/library/aa370578(VS.85).aspx

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Vijay Chander Wednesday, April 13, 2011 6:24 AM
    Thursday, April 7, 2011 4:06 PM
    Moderator
  • Thanks Mike for helping me on this.

    Regards,

    Vijay Chander.

    Wednesday, April 13, 2011 6:25 AM
  • You're welcome!

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 13, 2011 5:35 PM
    Moderator