Tag Archives: Visual Studio

Run as administrator missing for shortcuts created by Visual Studio Setup Project

When Visual Studio 2008 / 2010 creates Setup and Deployment project (Visual Studio Installer), it misses one important feature – ‘Run as administrator’ that is available form context menu (right mouse click) for shortcuts created on Desktop and in Start menu (under Windows Vista and Windows 7).

To get normal shortcuts you need to edit MSI file’s Shortcut Table using orca.exe tool.

Orca.exe is a database table editor for creating and editing Windows Installer packages and merge modules. The tool provides a graphical interface for validation, highlighting the particular entries where validation errors or warnings occur.

This tool is only available in the Windows SDK Components for Windows Installer Developers. It is provided as an Orca.msi file. After installing the Windows SDK Components for Windows Installer Developers, double click Orca.msi to install the Orca.exe file.

Source: msdn.microsoft.com

After installing, launch it form Start menu.

One discussion at microsoft.public.vstudio.general talks about the following scenario:
1) Examine your File table to see what the key is for the program you want to give a standard shortcut. Let's say the key is "myprog.exe".

2) Open the Shortcut table for your install and locate the shortcut entry you want to change.

3) Replace the Target value with "[#myprog.exe]". The brackets and pound sign are a Formatted string that tells WI to create a standard shortcut to the file.

But it does not work for me. My setup msi creates no shortcut at all.

Other forums talks about another approach, changing DefaultFeature to [TargetDir]\your_exe_file.exe, but that creates shortcut that links to root of system drive (c:\), not the actual target folder.

Later, checking Directory Table I noticed that I have TARGETDIR instead of TargetDir, so I changed DefaultFeature to [TARGETDIR]\your_exe_file.exe, and it now shows Run as administrator in context menu.

Update: I have figured out that [#myprog.exe] didn’t work because it should point to Key from File Table, and key is not always exe name. Have not tested this yet.

This is according to msdn.microsoft.com:
If a substring of the form [#filekey] is found, it is replaced by the full path of the file, with the value filekey used as a key into the File table.

Unable to connect to the Microsoft Visual Studio 2010 Remote Debugging Monitor in service mode

Rarely I need to use Visual Studio Remote Debugger to debug Native application. It always big pain to configure everything correctly. But today I needed to run Remote Debugger as service, so I can debug another service, when no any user is logged onto computer.

First strange thing I noticed, that I am able to run ‘Visual Studio 2010 Remote Debugger’ from start menu and it shows ‘Msvsmon started a new server named username@TESTSRV’. It should not happen because I already have debugger service running. I double checked that under Control Panel – Services.

At that point I thought that it is somehow possible to start multiple debugger services simultaneously using the same name. I tried to run another instance of Visual Studio 2010 Remote Debugger, and of course it failed with error:
Visual Studio Remote Debugging Monitor

An instance of msvsmon is already running on this machine under your user account. If you like to run multiple instances of msvsmon, you must use a different server name. Please enter a new server name.

Server name: [username@TESTSRV]
[OK] [Exit]

So it is not possible to run two servers with the same name and I have the Application and the Service running at the same time. So it must be a different name for the service then, but I can not find a way to get actual Server name for service.

Desperately trying to connect to Debugger service, I begun to play with Attach to process dialog. I always connected to remote machines using username@machine syntax. I tried to connect using machine name, username, IP address, but nothing worked. It sometimes displayed the following error:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named 'username@TESTSRV'. There is no server by the specified name running on the remote computer.
---------------------------
OK Help
---------------------------

Sometimes dialog window just closed without showing anything. And I got it. When it closes without en error there should be connection to remote machine going on, but why does dialog close? Instead of closing I tried to click on ‘Show processes form all users’ and it worked. It also worked if I clicked Refresh. To me it seemed a counter intuitive at that point. But the main pitfall was the Server name.

When you run Remote Debugger as Application the Server name is username@computername:

When you run Remote Debugger as Service the Server name is computername:

Also, note that I am using Workgroup configuration. I do not have a Domain.

Also, under Workgroup I can not run service under LocalSystem account. I am getting Kerberos authentication error:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named 'TESTSRV'. The Visual Studio Remote Debugger on the target computer cannot connect back to this computer. Kerberos authentication failed. Please see Help for assistance.
---------------------------
OK Help
---------------------------

More info: Visual Studio Debugger – Error: Kerberos Authentication Failed

So I am running service under administrator account with firewall disabled. (do not disable firewall if you are not in secure LAN)

I hope my experience with Remote Debugging will help someone to solve similar issues.

Microsoft Visual C++ supported target Windows versions

Microsoft Visual C++ supported target Windows versions – Supported Platforms – Target Platforms.

MSVC versions:

  • 6.0 Visual C++ 6.0.
  • 7.X Visual C++ .NET 2002, 2003 (7.0, 7.1).
  • 8.0 Visual C++ 2005.
  • 9.0 Visual C++ 2008.
  • 10.0 Visual C++ 2010.
  • 11.0 Visual C++ 2012.

6.0

7.X

8.0

9.0

10.0

11.0

Windows 95

ok

ok

hack

Windows 98

ok

ok

ok

Windows Me

ok

ok

ok

Windows 2000

ok

ok

ok

ok

ok¹

Windows Server 2000

ok

ok

ok

ok

ok¹

Windows XP

ok

ok

ok

ok

ok

ok²

Windows Server 2003

ok

ok

ok

ok

ok

ok²

Windows Server 2003 R2

ok

ok

ok

ok

ok

ok²

Windows Vista

ok

ok

ok

ok

ok

ok

Windows Server 2008

ok

ok

ok

ok

ok

ok

Windows 7

ok

ok

ok

ok

ok

ok

Windows Server 2008 R2

ok

ok

ok

ok

ok

ok

Windows 8

ok

ok

ok

ok

ok

ok

Windows 8 RT / ARM / METRO

ok

Windows Server 2012

ok

ok

ok

ok

ok

ok

6.0

7.X

8.0

9.0

10.0

11.0

NOTES:

  • This information is provided “as is”.
  • It is possible to build for any lower target (in some configurations), but it is not officially supported.
  • Most of this information is acquired by testing and analyzing System Requirements of various Microsoft Visual C++ Redistributable Packages
  • Visual C++ 2005 supports Windows 2000 beginning from Service Pack 3.
  • Visual C++ 2005 SP1 does not support Windows 98 and Me, but compiled exe usually works on these OSes.
  • Visual C++ 2008 supports Windows 2000 beginning from Service Pack 4.
  • Visual C++ 2010 supports Windows XP beginning from Service Pack 3. Source: Microsoft Visual C++ 2010 Redistributable Package (x86) and Visual Studio 2010 – Visual C++ Supported Platforms
  • Windows 95 is Windows 95 and Windows 95 Second Edition.
  • Windows 98 is Windows 98 and Windows 98 Second Edition.

¹ To target Windows 2000 must use Visual Studio Multi-Targeting (VS 2008 toolkit). Using VS 2010 tools will not run on Windows 2000.

² To target Windows XP and Server 2003 use Multi-Targeting. Microsoft promised to release “an update to Visual Studio 2012 that will enable C++ applications to target Windows XP”.

Updated Aug 15, 2010.
Updated Sep 5, 2012.