Home Page > Programming Samples and Tutorials > Deployment > Deploy Tutorial
Deploy Tutorial
Deploy Tutorial
The delployment method described below is flexible, but more involved
way to redistribute KernelCAD. You might find a simpler method desribed in
Redistribution
This tutorial demonstrates steps required to distribute an application which
uses KernelCAD components. The tutorial is based on Microsoft Visual Studio
2008. The project can be opened with an automatic upgrade with later versios of
Visual Studio. With
adjustments for different user interface the same steps are required when
using different installer creation software like Install Shield.
The installer will install MiniCAD.exe from the MiniCAD sample. It is a native
C++ application. If an application uses .NET version of components KerCADe.ocx below must be replaced with KerCADne.ocx with
relevant adjustments of names in registry etc.
A copy of the completed project is available in Samples\Deploy folder. The
completed project is based on 32 bit KernelCAD product.
See also: Redistribution
File System
- In Microsoft Visual Studio select File > New > Project. In the New
Project dialog expand "Other Project types" in the left panel and select
"Setup and Deployment"
- In the right-hand side panel select "Setup Project". Select location for
the project at the bottom and type "Deploy" for the name.
- When the project is created Visual Studio opens File System window. It
can be closed and re-opened using icons on top of the Solution Explorer.
- Select "Application Folder" in the File System window and select Action > Add >
File in menu. Browse to the installation folder of KernelCAD, which is
C:\Projects\KernelCAD_5_2 by default
- Select MiniCAD.exe. Press Open. The MiniCAD.exe will appear in the right hand
side panel of the File System window.
- In the same manner add all files, except the ones with .exe extension from KernelCAD_5_2\Bin folder of the
KernelCAD installation directory to the Application Folder. Use Ctrl+a to select
all files. Hold the control key and deselect any files which need to be
excluded.
- Add RegAll.exe located in KernelCAD_5_2\Bin directory to the Application Folder
- The whole "data" subfolder of KernelCAD_5_2\Bin has to be added to the
installation too without any change. Use right-click > Add > Folder option to
create data folder and its subfolders. Add its contents.
- Right-click the added KerCADe.ocx and select "Properties Window". Make
sure that Register property in Property Window is vsdrfDoNotRegister. Repeat the same for KerCADne.ocx
- If there are two copies of KerCADne.ocx (a duplicate can be automatically
incorrectly added by Visual Studio) select one of them and delete. If deletion
does not work select the file and its properties change Exclude to true
- Select Application Folder in the left hand pane of the File System
window and in context menu select Add > Folder. Change name of the folder to
Models. The name can also be changed using the Properties Window. Add new
Samples sub folder to the Models folder in the same manner.
- Add MiniCAD.glm from Models\Samples folder of KernelCAD directory to the
Models\Samples folder of the target directory
- Add Gen.ico file located in KernelCAD_5_2 to the Application Folder
- In the Solution Explorer of the Visual Studio select the Deploy top item. If the
properties window (View > Properties Window) click at the end of the
AddRemoveProgramIcon line and in the appeared dialog browse to the Gen.ico
- If you are using 64 bit KernelCAD change TargetPlatform property
of the project to x64
- Change the remaining properties of the project as appropriate
- Select User's Programs Menu folder in File System window. Right-click
into right hand pane and select "Create New Shortcut". Select MiniCAD.exe in
the dialog and press OK. Change name of the shortcut to MiniCAD. In the properties
window change the Icon property to Gen.ico similar to the above
- Make sure that the active configuration is Release (Builld > Configuration
Manager). Select Build > Rebuild solution. The files located in the
Deploy\Release folder are the files to be deployed to the target computer
Registration And DirectX
To register the installed controls on the target machine:
- Select the Deploy project in Solution Explorer of Visual Studio and press Custom
Actions editor icon on top of the Solution Explorer window
- In the opened Custom Actions editor right-click on the Install stage and select
Add Custom Action.
- In the opened dialog browse and select RegAll.exe. Rename the appeared item to
RegAll
- With the RegAll item selected open properties window and replace contents of the
Arguments property with KerCADne.xreg KerCADe.xreg
- In the same manner add UnRegAll custom step to Uninstall stage. The action
should use the same RegAll.exe. The Arguments property should be the same, apart
from the /u switch: /u KerCADne.xreg KerCADe.xreg
- In the Custom Actions Editor add another custom action to the Install stage. When prompted Browse to the Application Folder\Bin\DirectX9_43 and select DXSETUP.exe.
Name the action DirectXSetup. Set /silent as its Arguments property
See also: Registration.
Locating model on target computer
Enabling EmbeddedModel
property
of the control allows bundling the required model into compiled executable file.
With this option there is no need for adding MiniCAD.glm and Models folder to
the target file system.
Another method to point an installed application to required model file is
the <EXEPATH> modifier of the ModelPath.
In our case MiniCAD application would have to be recompiled with ModelPath
changed to <EXEPATH>Models\Samples\MiniCAD.glm. In this case <EXEPATH> would be
interpreted on the target machine as location of MiniCAD.exe, which is the
target folder
In this particular case ModelPath
of the control in MiniCAD sample is set to Models\Samples\MiniCAD.glm, so by
default the MiniCAD application looks for the MiniCAD.glm model in
Models\Samples folder of KernelCAD installation directory, which is not expected
to be installed on the target computer.
To avoid recompilation of MiniCAD we will demonstrate yet another method:
- Select Deploy node in Solution Explorer and click on Registry Editor
icon on the top of the window
- In the opened Registry window Expand HKEY_LOCAL_MACHINE key. and select Software key. Select New > Key from background menu. Change name of the key to DInsight. Continue in the same manner to create HKEY_LOCAL_MACHINE\SOFTWARE\DInsight\KerCADe\5_2
- Select the added 5_2 key and in context menu select New > String Value.
Change name of the value to InstallDir. Select the InstallDir node and in
Properties window change Value property to [TARGETDIR] with the brackets
included.
Above will store the installation path of your application chosen by the user
into InstallDir string and the control will find it there at runtime.
C++ Runtime libraries
To add Microsoft's C++ dependencies:
- Download KcRedist_5_2.zip (KcRedist_x64_5_2.zip for 64 bit installer) from
http://www.dynoinsight.com/ProDown.htm and extract it into KcRedist_5_2 folder in a temporary location
- Right-click DeployModule project in Solution Explorer of Visual Studio and
select Add>Merge Module. Browse and select the two Microsoft*.msm files in the KcRedist_5_2 folder. They will appear in Solution Explorer of Visual Studio
Installer titles and properties
- Select Deploy node in solution explorer and change ProductName property
in Properties Window to "MiniCAD v1.0"
- Change Title property to "MiniCAD v1.0 Setup"
Building and testing
- Make sure that the active configuration is Release via Build >
"Configuration Manager" menu option of Visual Studio
- Build the project with Build > Build Solution. Make sure that there are
no errors in the output window
- The Deploy.msi and setup.exe created in Release folder is the output of
the project. To make sure the application works without KernelCAD it is recommended to copy the two files to another machine or uninstall KernelCAD
temporary
- Run setup.exe to install the application. Select MiniCAD in Start menu
to test the application.
- Uninstall the MiniCAD application using "Add or Remove Programs" from
Control Panel
|