Sreeraj
Sreeraj

Reputation: 21

How to create windows MSI in separate solution?

How to Create a MSI for windows Applications which is available in different visual studio solution.

Upvotes: 1

Views: 1159

Answers (1)

Matt
Matt

Reputation: 27001

If you have installed the installer extension (if not, see notes below), open Visual Studio, then do the following (at this point, no solution is opened):

  1. If you start with a new solution, select File -> New Project.
    (In case you want to add the installer project to an existing solution instead, right click on the solution in the solution explorer and choose from the context menu Add -> New Project.)

  2. In the New Project dialog, select "Other Project Types", then "Visual Studio Installer" and there "Setup Wizard" (Alternatively you can also select a Windows setup project or a Web setup project directly - the wizard has the advantage that it will ask you about several items)

  3. In the Setup Wizard, you can choose whether you want to create a setup for a Windows application or for a Web application. Here, select Windows application.
  4. Click Next >. The "Choose files to include" dialog appears.
    This step is important, because here you specify which files you want to add to your installer package. Check the items you need to include - for localized projects I suggest that you add: "Locally copied items, Runtime Implementation, Localized resources, Content files" and "Primary output."
  5. Click Next > again to bring up the last page ("Create project" dialog), then click Finish

You have now a solution with one setup project. Now you can add an existing project (select the solution, right-click and select "Add existing project"). After you have done that, right-click on the setup project and select "Add -> Project Output". Now you can select the items to be included in your setup project.

If required, you can also add other assemblies via "Add -> Assembly..." or, if you have that, you can add merge modules.


Notes

  • You need to install the extension "Microsoft Visual Studio 2017 Installer Projects" (via Tools -> Extensions and Updates, search it online in the Visual Studio Marketplace) to be able to select the installer as described above
  • that the project you have added can be part of a different solution.
  • The 4 most important properties of a setup package are: Version, ProductCode, Upgrade code and Platform (default is x86). Version is just a number (e.g. 1.0.1) while the other two properties are GUIDs. If you change the version in the package properties, then Visual Studio asks to create a new ProductCode (if you answer the question with "Yes" - which is recommended). This allows the Windows installer to distinguish the differrent packages from one another and allows to upgrade a package, because the UpgradeCode isn't changed.
  • Additionally, the default value for RemovePreviousVersions is false - but in most cases you want to change this to true (remember what I said before about ProductCode and UpgradeCode): To remove old versions automatically when you install a new version.

Upvotes: 1

Related Questions