How do I add .NET assemblies to an installation?
When creating .NET installations, the first thing you should do is set the preferences for the installation.
Setting .NET preferences for default project files
Click the .NET Assemblies tab.
In Windows Installer editor, click the Tools menu then select Options. The Wise Options dialog appears.
Note: Options on the .NET Assemblies tab are only available if you have the .NET Framework installed on your computer.
Fill out the tab as described below:
- Default Application Type. Select a default to use when you create a new .WSI project file:
- Win32 (non .NET). Select this option if your application is a standard Win32 application with no .NET assemblies.
- .NET Application. Select this option if your application contains only .NET elements.
- Mixed (.NET and Win32). Select this option if you have a mix of managed and unmanaged code in your application. This installs .NET assemblies so that they can be called as if they were COM components.
- Rescan COM interop registry keys on compile. Mark this check box to rescan these registry keys each time you compile your project file.
- Scan Dependencies. Select whether to Always Scan, Never Scan or Prompt to Scan the manifest for each .NET assembly you add. When you allow Wise for Windows Installer to scan the manifest, it prompts you to add dependencies that it finds in the manifest that are not in your installation.
- Rescan assembly dependencies on compile. Mark this check box to rescan your assemblies for new dependencies each time you compile.
When you add .NET assemblies to your installation, you need to decide whether they are shared assemblies that should be installed to the Global Assembly Cache on the destination computer, or whether they are private assemblies to use with your application. You can install private assemblies to the application directory. The Global Assembly Cache folder only appears when you are working with a .NET or mixed (.NET and Win32) installation. If you are inserting a shared .NET assembly into the Global Assembly Cache, this must be a strongly named assembly. Add either the private or global assemblies on the Files page in Installation Expert. Then add details for the file.
Adding .NET assembly and manifest details for a file
- On the File page, select the file in the lower-right list box that you added to your installation; then click the Details button. The File Details dialog appears.
- Click the .NET tab. The information you add on this tab is used to populate the MsiAssembly and MsiAssemblyName tables in the MSI database.
- Fill in the tab as described below:
- Assembly Type. Select either .NET or Win32 assembly. If the file is not an assembly, select None.
- Manifest. Select the file that contains the manifest for this assembly. For .NET assemblies this is often the same as the file you are editing because most manifests are embedded in the assembly file or in one of the files in a multifile assembly. For Win32 files, the manifest file is often an external file with the same name plus ".manifest".
- Assembly Attributes. This list box displays this assembly file's name, publicKeyToken, and version attributes. If this information has not been filled in automatically, you must use the Add button to enter it. Enter the Name and Value for the assembly's name, publicKeyToken, and version.
- Show reference in Visual Studio .NET. Mark this to add a registry key that displays this assembly as a reference in Visual Studio on the destination computer. (Visual Studio .NET 2002 or later only.) This lets you pull the assembly into a Visual Studio project without having to browse for it.
Execute Install method on this assembly. A .NET assembly can contain an install object that performs additional installation functions unique to the assembly. Mark this to execute this assembly's install object after the file is installed.
- Generate native-code version during installation. Mark this to run the Native Image Generator (ngen.exe) on the assembly after it is installed. The Native Image Generator precompiles portions of the assembly and caches it on the target computer so assemblies load and execute faster.
- Click OK.
Note: Information for .NET assemblies is automatically pulled in when you add your .NET assembly as long as the .NET Framework is installed on your computer.
The Options and File Details dialogs in the Windows Installer Editor have .NET tabs that let you quickly add shared and private .NET assemblies to your installation. They also give you the ability to update and maintain assembly dependencies during compile, which simplifies the process of developing your application and installation.