MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Visual Studio Integration - Dummy Project[Next]: [CONTENTS]
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->User Contributions->Visual Studio Integration->Visual Studio Integration - VS Add-In

Visual Studio Integration - VS Add-In

This information and/or code in this section was provided by dumbarton13 (thank you).

I use Visual Studio constantly as a developer and it seemed useful to integrate MAKEMSI. Here are some notes on what I did. I am using VS .NET 2003.

Create a VS Solution

For each MAKEMSI project, create a blank Solution and call it, say,
MakeMsiMyApp.
Locate it in your development folder, eg C:\My
Projects\MakeMsiMyApp.
Copy the template files, Tryout.mm and Tryout.ver, from the MAKEMSI
installation directory and rename them as MakeMsiMyApp.mm and
MakeMsiMyApp.ver. Alternatively create your own .mm and .ver files
or copy ones from a previous project.
You can also move Company.mmh and Dept.mmh from the MAKEMSI
installation folder as you will probably also need to modify these.
In VS from the Files or Project menu, use the 'Add Existing Item...'
dialog to add these files to the Solution.
In addition, copy other files you will need into the project
folder. These might include merge modules, splash bmp's, background
bmp's, icons, etc. plus any other files you will want to burn onto
an installation CD such as license and readme.txt, autorun.inf,
instmsia/w.exe, setup.exe, etc.

VS Editing

Your .mm and .mmh files can be edited using all the facilities of
the VS editor and its support environment.
Unfortunately syntax coloring and checking (àla C++ and VBS files)
requires a VSIP license which costs a small fortune and takes a
major development effort. (See the recent VS integration of Perl,
Python and XSLT by ActiveState).

  >The following added by "Rich" 28 Mar 2004
  >I can say that a VSIP SDK can be obtained for free; they used to
  >charge for it, but now you can get it by simply registering yourself
  >as a vendor.  So someone could do some work on syntax coloring, etc.,
  >if that is really important to a user.


The .mm and .mmh most closely resemble Microsoft Assembler format
where comment lines, for example, are also indicated by a ';'. It
is a simple matter to direct .mmh and .mm files to use the .asm VS
template but, alas, Microsoft has not developed syntax coloring
for .asm files! They probably reckon there are not many of us MASM
programmers still around!
However one useful thing to do is to add the .mmh and .mm file types
into the registry. These types are not used by anyone else, at least
not on the systems we have (well chosen, Dennis!!) This can be done
by running regedit. Right-click HKEY_CLASSES_ROOT and use the 'New'
option. Rename the resulting key as .mmh. Repeat for .mm. Using
the registry entries for .asm as a model, select the new .mmh
and .mm keys in turn and add the 'OpenWithList', 'OpenWithProgIds'
and 'PersistentHeader' subkeys, together with all their value/data
pairs to complete the task.

MAKEMSI Compile Tool

There are a number of ways to add a tool to VS, the easiest perhaps
using a macro.
However I chose to develop a VS Add-In. To do this, select a Visual
Studio .Net Add-In project from the Other Projects > Extensibility
Projects options in the New Project dialog. Give the solution a
name, say MakeMsiAddIn.
In the Setup Wizard, select a Visual Basic project on page 1, leave
both application hosts ticked on page 2, enter 'MakeMsi Compiler'
and 'MakeMsi Windows Installer Database Compile Tool' in the two
fields on page 3, tick all four boxes on page 4, tick the box and
edit the dialog if you want a Help About box on page 5, review your
settings on page 6 and click Finish.
In the resulting project, open the file connect.vb in the VS editor
and add the following 7 lines to the subroutine Exec between the
existing lines "if cmdName = ...." and "handled = True"

Try
applicationObject.ExecuteCommand("File.SaveAll")
ChDir(Left(applicationObject.Solution.FullName(), _
InStrRev(applicationObject.Solution.FullName(), _
"\", -1, CompareMethod.Text) - 1))
Shell(Environ("COMSPEC") & " /K Title MakeMsi Compiler && """
& _
Environ("MAKEMSI_DIR") & "mm.cmd"" && pause && exit", _
AppWinStyle.NormalFocus, True, 500000)
Catch ex As System.Exception
MsgBox(ex.ToString())
End Try

At the same time, change the line in the subroutine OnConnection
which says

CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn,
_
"MakeMsiAddIn", "MakeMsiAddIn", _
"Executes the command for MakeMsiAddIn", True, 59, Nothing, 1
+ 2)

Due to a Microsoft bug, you need to insert the entries you made on
page 2 of the Setup Wizard. The result should look something like:

CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn,
_
"MakeMsiAddIn", "MakeMsi Compiler", _
"MakeMsi Windows Installer Database Compiler Tool", _
True, 59, Nothing, 1 + 2)

Incidentally, the '59' refers to a standard Office icon, a smiley
face. Must be some kind of Microsoft joke! You can do some
research and change it! See www.codeproject.com for an article on
implementing your own icon.

Build the project. Then build the MakeMsiAddInSetup project (in the
same Solution), right-click it in the Solution Window and click
Install on the popup menu. Close VS and re-open. The MAKEMSI
Compiler tool should be listed at the top of the Tools menu. If it
is not, open the Add-In Manager dialog from the Tools Menu. The
MAKEMSI Compiler Tool should be listed there. Tick all the boxes
and reload VS. If there is still a problem, look in the Registry
key HKLM/HKCU > Software > Microsoft> Visual Studio > 7.1 >
PreLoadAddInState, make sure the value MakeMsiTool.Connect has an
entry of 1 not 0. If necessary modify. Exit and reload VS.

Launching the MakeMsiAddIn from the VS Tools menu closes any .mm
or .mmh files open in the editor and calls the MAKEMSI compiler to
search for a .mm file in the solution directory and compiles it.

MAKEMSI Help

Microsoft supplies a free Visual Studio Help Integration Kit (VSHIK)
in MSDN. I have downloaded the version for VS .NET 2003. From a
quick review it would take some effort to modify the existing
MskeMsi Help to conform with the VS .NET documentation model.
Access to the original .htm help files would undoubtedly be needed.

Conclusion

The limited VS integration described above is not difficult and the
results are worthwhile in terms of ease-of-use and time savings.

As a final step, it would be appropriate to tie all the above into a
Windows Installer package using MAKEMSI!! If only I had time.

Post any further suggestions or related questions.

Regards - John


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Visual Studio Integration - Dummy Project


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.