Visual Studio 11 Beta Problem - TRACKER error TRK0005, TRK0002


2012-05-20 This is an update to the original post of 2012/05/09 that was partially correct.

The Problem

When linking with VS11 Beta, you receive a TRACKER error of TRK0005 or TRK0002 referencing either rc.exe or mt.exe. This means that VS11 Beta cannot find the tools needed for manifest generation.

What Works

Fixes that Work
Explicitly add path to WinSDK x86 bin directory to VC++ Directories/Executable Directories for every project under Property Pages
Add WinSDK x86 bin directory to system PATH
Disable manifest generation.

What Doesn't Work

Things that don't work but should
Adding WinSDK x86 bin path to VC++ Directories/Executable Directories in Microsoft.Cpp.Win32.user and Microsoft.Cpp.x64.user Property Pages
Adding a custom Property Page to the project that contains the WinSDK x86 bin to the Project
Reset settings in Visual Studio 11 Beta

Background

I've just started using Visual Studio 11 Beta. One of the nice additions to VS11 is that it incorporates the idea of multiple platform toolsets - that is, compilers. On the Property Pages for a project under Configuration Properties/Platform Toolset is a drop-down list of the registered compilers.

List of registered compilers to use with VS11 Beta

Visual Studio 11 Beta Platform Toolset Menu

Linking Fails due to Problems with Manifest Generation

Compilation works fine with Visual Studio 2010. (I haven't tested the others.) When I switched to the Visual Studio 11 compiler, I get the error:

TRACKER : error TRK0005: Failed to locate: "rc.exe". The system cannot find the file specified.

TRK0005 Linking Fails

TRK0005 Linking Fails in Visual Studio 11 Beta

 

Sometimes I get the error

TRACKER : error TRK0002: Failed to locate: "rc.exe". The system cannot find the file specified.

TRK0002 64bit Windows SDK Path Error

TRK0002 64bit Windows SDK Path Error in Visual Studio 11 Beta

Playing around trying to fix the problem I sometimes got the same errors except with mt.exe instead of rc.exe.

Searching on Google didn't turn up much useful; StackOverflow.com did point me in the right direction: mt.exe and rc.exe come with Windows SDK and are part of the packaging and manifest generation that Visual Studio does by default.

Manifest?

OK, I know the manifest is important for .NET assemblies. Does it matter for native code? According to Building C/C++ Isolated Applications and Side-by-Side Assemblies, the manifest helps ensure that the distributed application is running with the right DLLs; in other words, it addresses DLL Hell as described in the (somewhat poorly named) Simplifying Deployment and Solving DLL Hell with the .NET Framework.

How to Fix

There are at least three ways to address the problem:

  1. Specify a per-project directory list for Executables Directories.
  2. Add the appropriate WinSDK path to the system PATH environment variable.
  3. Disable manifest generation.

Specify a per-project directory list

Pros

  • Quickest fix for one or a few projects
  • Moves with project(s) to other computers
  • Maintains manifest

Cons

  • Must repeat for every Project.

  1. Visual Studio 11 Beta installs the Windows 8 SDK. Both 32bit and 64bit projects use the 32bit resource tools. The default installation directory is C:\Program Files (x86)\Windows Kits\8.0\bin\x86. I like to setup an environment variable for this, as %WINSDK32BIN%, referenced as a Visual Studio Macro as $(WINSDK32BIN).
  2. In VS11B Solution Explorer, right-click on the project name, select Properties to pop up the Property Pages.
  3. In the left pane, expand Configuration Properties the left-click on VC++ Directories.
  4. In the right pane, expand General then left-click on Executable Directories to get the drop-down menu at the far right.
  5. Choose Edit from the drop-down menu and the Executable Directories pop-up appears.
  6. Double click in the top frame and enter the path to the WinSDK x86 bin directory.
  7. Confirm with OK, OK. You can now build and link your project without errors
    Property Pages in Visual Studio 11 Beta C++

    Property Pages

    VC++ Directories Executable Directories Page

    VC++ Directories Executable Directories Page

    .

 

Add WinSDK to system PATH

Pros

  • Applies to all projects on a single computer.
  • Maintains manifest.

Cons

  • Does not move with project to a new computer.
  • The PATH environment variable is always squeezed for space.
  1. Modify the PATH environment variable to include the WinSDK path.
  2. Exit and restart Visual Studio 11 Beta.

Disable the Manifest

Pros

  • Applies to all projects on a single computer.
  • Moves with projects to other computers.

Cons

  • Stops manifest creation, which helps address DLL Hell.

This disables manifest generation for all projects on a particular installation of Visual Studio 11 Beta.

  1. In VS11 Beta, open the Property Manager with View->Property Manager.
  2. Expand any project and then open either Debug or Release.
  3. Double-click on Microsoft.Cpp.Win32.user. (Note, for 64bit builds, you need to modify Microsoft.Cpp.x64.user in the same manner.)
  4. In the left pane, expand Common Properties and then Linker.
  5. Under Linker, click All Options.
  6. In the Look for options or switches: window (thank you, Microsoft!) type manifest without the quotes.
  7. Use the Generate Manifest drop-down and select No.
  8. Confirm with a couple OKs and you are ready to build sans manifest.
Drop Down Menu in Property Pages/Linker/All Options

Visual Studio 2011 Beta C++ Disable Manifest Generation

 

Done

Your Visual Studio 11 Beta now can link native code without manifest errors.

Leave a Reply