How To: Fix error MSB3091 During MSBuild

20/06/2009

5 comments

How To: Fix error MSB3091 During MSBuild

Building Build Script for a customer I got the following error:

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1756,9): error MSB3091: Task failed because "LC.exe" was not found, or the correct Microsoft Windows SDK is not installed…….

It seems like “LC.EXE” was not found and I need to install “Microsoft Windows SDK for Server 2008 and .NET Framework 3.5” (Running build on server 2003 machine).

LC.EXE” is the License Compiler comes with .NET Framework Tools so why the Build cannot find this file?

We can solve this small issue in couple ways:

1. You can try to reinstall Windows SDK or Install it – Link

2. Add the direction path to the registry:

Open “regedit” and goto HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A

Than add this key –> InstallationFolder=C:\Program Files\Microsoft SDKs\Windows\v6.0A\

Now Team Build have the right directions to Windows SDK files.

Hope this helps.

Add comment
facebook linkedin twitter email

Leave a Reply

5 comments

  1. pradana28/07/2009 ב 12:47

    I think that SDK’s version is 6.1? Why the registry points to 6.0?

  2. kevin28/07/2009 ב 23:03

    I to am having this problem. On a Windows 2008 Small Business Server, I get this error. Looking in the registry, there are only entries for version 6.1. Do I need to upgrade msbuild?

  3. mike27/01/2010 ב 21:47

    Unfortunately, this doesn’t work. Has anyone managed to figure out this problem?

  4. granadaCoder07/07/2010 ב 19:44

    Another note about this.

    You actually need to poke around and find where your LC.EXE exists on your machine.

    Note, on my 64 bit Windows 2008 Server machine, the registry key for “InstallationFolder” had this:

    C:\Program Files\Microsoft SDKs\Windows\v6.0A\

    Yet, when I poked around looking for the file, I found this location:
    C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\lc.exe

    Thus I had to change the InstallationFolder registry value to:
    C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\

    Which is exactly what Option(3) of the error message is telling you.

    errorMSB3091: Task failed because “LC.exe” was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for “LC.exe” in the “bin” subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the “ToolPath” parameter of the task.

    I’ll give the Microsoft guys an A+ on the error message on this one.

  5. granadaCoder07/07/2010 ב 21:50

    I should have waited til I got it working. Fooey on me.

    Everything related to the above did not work.
    (Registry changes and installs).

    I got it working by manually overriding the msbuild command line parameter.

    /p:LCToolPath=”C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin”

    Or if you’re putting into configuration xml:

    /p:LCToolPath="C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin"

    If you search for LCToolPath, you’ll find some other hints.

    Wow, there’s a day of my life I’ll never get back.

    But at least we have blogs and such to find answers.