Microsoft KB Archive/830612

= The Target values of the shortcuts are wrong after you install a Windows Installer package that was created by using Visual Studio .NET =

Article ID: 830612

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Windows Installer 2.0
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





SYMPTOMS
You can create a Microsoft Windows Installer package by using the Setup and Deployment Projects option in Microsoft Visual Studio .NET. However, if the installer package contains a shortcut file, the path of the destination file that appears in the Target box in the properties of the shortcut file after you install the package is wrong.



CAUSE
This behavior occurs because the Create Shortcut functionality in Microsoft Windows does not support the use of Windows Installer Descriptor shortcuts.



WORKAROUND
To work around this problem, edit the installer package (the .msi file) to change the target value of the shortcut.

You can use the Orca database editor to edit the installer package. The Orca database editor is available as part of the Microsoft Windows Installer Software Development Kit (SDK). To download the Windows Installer SDK, visit the following Microsoft Web site:

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

For additional information about the Orca database editor, click the following article number to view the article in the Microsoft Knowledge Base:

255905 HOWTO: Use the Orca database editor to edit Windows Installer files

To work around this problem, follow these steps:  Edit the installer package by using the Orca database editor:  Start Orca. On the File menu, click Open. In the Open dialog box, locate the folder that contains the Setupproj1.msi file.

Note For more information about the Setupproj1.msi file that is created in the C:\Setupprojects\Setupproj1\Debug folder, see step 3 in the &quot;More Information&quot; section of this article. Click the Setupproj1.msi file, and then click Open. In the Tables pane, click File.</li> In the right pane, select the row that has the value WINAPP1.EXE|Winapp1.exe in the FileName column, and then copy the associated value that appears in the File column.</li> In the Tables pane, click Shortcut.</li> In the right pane, select the row that has the value SHORTC~1.EXE|Shortcut to Winapp1.exe in the Name column.</li> In the Target column, replace the existing value with the value that you copied in step f.</li> On the File menu, click Save, and then quit the Orca database editor.</li></ol> </li> Install the Setup project.

Note If the Setupproj1 Setup project is already installed on your computer, remove it before you follow these steps. <ol style="list-style-type: lower-alpha;"> In Windows Explorer, locate the folder that contains the Setupproj1.msi file. By default, this is the C:\Setupprojects\Setup1\Debug folder.</li> Double-click the Setupproj1.msi file. The Setup Wizard starts.</li> On the Welcome to the Setupproj1 Setup Wizard page, click Next.</li> On the Select Installation Folder page, type C:\InstalledProjects\Setupproj1 in the Folder box, and then click Next.</li> On the Confirm Installation page, click Next.</li> On the Installation Complete page, click Close.</li></ol> </li> Verify the target value of the shortcut: <ol style="list-style-type: lower-alpha;"> In Windows Explorer, locate the C:\InstalledProjects\Setupproj1 folder.</li> Right-click the Shortcut to Winapp1.exe file, and then click Properties.</li> In the Shortcut to Winapp1.exe Properties dialog box, click the Shortcut tab.</li> <li>On the Shortcut tab, notice that the value that appears in the Target box is C:\InstalledProjects\Setupproj1\bin\Winapp1.exe.</li></ol> </li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to reproduce the problem
To reproduce this problem, follow these steps: <ol> <li>Create a Windows Application project: <ol style="list-style-type: lower-alpha;"> <li>Start Visual Studio .NET.</li> <li>On the File menu, point to New, and then click Project. The New Project dialog box appears.</li> <li>Under Project Types, click Visual C# Projects.</li> <li>Under Templates, click Windows Application.</li> <li>In the Name box, type Winapp1 .</li> <li>In the Location box, type C:\Winprojects, and then click OK.</li> <li>On the Build menu, click Build Solution.</li></ol> </li> <li>Create a Windows Installer project: <ol style="list-style-type: lower-alpha;"> <li>Start Visual Studio .NET.</li> <li>On the File menu, point to New, and then click Project. The New Project dialog box appears.</li> <li>Under Project Types, click Setup and Deployment Projects.</li> <li>Under Templates, click Setup Project.</li> <li>In the Name box, type Setupproj1 .</li> <li>In the Location box, type C:\Setupprojects, and then click OK.</li></ol> </li> <li> Add files to Setupproj1: <ol style="list-style-type: lower-alpha;"> <li>Add the files from the Winapp1 folder to Setupproj1: <ol> <li>On the File System (Setupproj1) tab, right-click Application Folder, point to Add, and then click File. The Add Files dialog box appears.</li> <li>In the Add Files dialog box, locate the C:\Winprojects\Winapp1 folder.</li> <li>Select all the files that appear in the Winapp1 folder, and then click Open.</li></ol> </li> <li>Add the Bin folder to Setupproj1: <ol> <li>In the File System (Setupproj1) window, right-click the Application Folder folder, point to Add, and then click Folder.</li> <li>For the name of the new folder, type bin .</li></ol> </li> <li>Add the Winapp1.exe file from the C:\Winprojects\Winapp1\Bin\Debug folder to Setupproj1: <ol> <li>On the File System (Setupproj1) tab, right-click the bin folder, point to Add, and then click File. The Add Files dialog box appears.</li> <li>In the Add Files dialog box, locate the C:\Winprojects\Winapp1\Bin\Debug folder.</li> <li>Click the Winapp1.exe file, and then click Open.</li></ol> </li> <li>Add a shortcut file to Setupproj1: <ol> <li>In the right pane, right-click Winapp1.exe, and then click Create Shortcut to Winapp1.exe.</li> <li>Move the Shortcut to Winapp1.exe file to the Application Folder folder.</li></ol> </li> <li>On the Build menu, click Build Solution. The Setupproj1.msi file is created in the C:\Setupprojects\Setupproj1\Debug folder.

back to the &quot;Workaround&quot; section</li></ol> </li> <li>Quit Visual Studio .NET.</li> <li>Install the Setup file: <ol style="list-style-type: lower-alpha;"> <li>In Windows Explorer, locate the C:\Setupprojects\Setupproj1\Debug folder.</li> <li>Double-click the Setupproj1.msi file. The Setup Wizard starts.</li> <li>On the Welcome to the Setupproj1 Setup Wizard page, click Next.</li> <li>On the Select Installation Folder page, type C:\InstalledProjects\Setupproj1 in the Folder box, and then click Next.</li> <li>On the Confirm Installation page, click Next.</li> <li>On the Installation Complete page, click Close.</li></ol> </li> <li>Verify that the shortcut file for the destination file exists: <ol style="list-style-type: lower-alpha;"> <li>In Windows Explorer, locate the C:\InstalledProjects\Setupproj1 folder.</li> <li>Right-click the Shortcut to Winapp1.exe file, and then click Properties. The Shortcut to Winapp1.exe Properties dialog box appears.</li> <li>Click the Shortcut tab.</li> <li>On the Shortcut tab, notice that the value in the Target box is Setupproj1. This is the name of the Windows installer project that you created in step 2.

The expected value in the Target box is C:\InstalledProjects\Setupproj1\bin\Winapp1.exe. This is the path of the destination file that you created this shortcut to in step 3d.</li></ol> </li></ol>

<div class="references_section">