Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain registry keys cause link to fail unless linker is run as administrator #4753

Closed
wixbot opened this issue May 8, 2015 · 5 comments · Fixed by wixtoolset/Core#220
Closed
Assignees
Milestone

Comments

@wixbot
Copy link

wixbot commented May 8, 2015

Product definition below fails to build with the following errors.

There is one workaround:

  1. Run Visual Studio (therefore, presumably, linker) as an administrator during the build.
------ Build started: Project: WixBug, Configuration: Debug x86 ------
    C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -dDebug -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\\" -dSolutionDir=C:\Users\Autobuild\BUILD\WixBug\ -dSolutionExt=.sln -dSolutionFileName=WixBug.sln -dSolutionName=WixBug -dSolutionPath=C:\Users\Autobuild\BUILD\WixBug\WixBug.sln -dConfiguration=Debug -dOutDir=bin\Debug\ -dPlatform=x86 -dProjectDir=C:\Users\Autobuild\BUILD\WixBug\WixBug\ -dProjectExt=.wixproj -dProjectFileName=WixBug.wixproj -dProjectName=WixBug -dProjectPath=C:\Users\Autobuild\BUILD\WixBug\WixBug\WixBug.wixproj -dTargetDir=C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\ -dTargetExt=.msi -dTargetFileName=WixBug.msi -dTargetName=WixBug -dTargetPath=C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\WixBug.msi -out obj\Debug\ -arch x86 Product.wxs
    C:\Program Files (x86)\WiX Toolset v3.8\bin\Light.exe -out C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\WixBug.msi -pdbout C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\WixBug.wixpdb -cultures:null -contentsfile obj\Debug\WixBug.wixproj.BindContentsFileListnull.txt -outputsfile obj\Debug\WixBug.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Debug\WixBug.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile C:\Users\Autobuild\BUILD\WixBug\WixBug\WixBug.wixproj obj\Debug\Product.wixobj
C:\Users\Autobuild\BUILD\WixBug\WixBug\Product.wxs(13,0): warning LGHT1079: The cabinet 'wixbug.cab' does not contain any files.  If this installation contains no files, this warning can likely be safely ignored.  Otherwise, please add files to the cabinet or remove it.
C:\Users\Autobuild\BUILD\WixBug\WixBug\Product.wxs(41,0): error LGHT0204: ICE03: Invalid registry path; Table: Registry, Column: Key, Key(s): reg2
C:\Users\Autobuild\BUILD\WixBug\WixBug\Product.wxs(39,0): error LGHT0204: ICE03: Invalid registry path; Table: Registry, Column: Key, Key(s): reg1
Done building project "WixBug.wixproj" -- FAILED.

Project:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*"
           Name="WixBug"
           Language="1033"
           Version="1.0"
           Manufacturer="WixBugMakerLtd"
           UpgradeCode="FFA36ABD-BDB1-4CB8-ACF4-B1BEF2DCC2E0">

    <Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" />

    <Media Id="1" Cabinet="wixbug.cab" EmbedCab="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />


    <Feature Id="idWixBug" Title="WixBug" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="MAN" Name="WixBugMakerLtd">
          <Directory Id="INSTALLFOLDER" Name="WixBug" />
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">

      <Component Id="cmpSiraEncoderService" Guid="E61268BA-738D-42D4-AF1A-1E30FF05F9F0">

        <RegistryKey Id="reg1" Root="HKLM" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"
                     Key="Software\WBM\WB\">
          <RegistryValue Id="reg2" Type="string" Name="InstallationPath" Value="[INSTALLFOLDER]" />
        </RegistryKey>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

Originally opened by rob

@wixbot
Copy link
Author

wixbot commented May 19, 2015

The problem is the backslash at the end of RegistryKey/@Key. Remove that and it builds fine. The compiler should detect that and not double the backslash in the Registry table.

Release changed from v3.8 to v3.x

@cpuwzd
Copy link

cpuwzd commented Jan 24, 2021

What I am feeling might be akin to buyer's remorse, but here goes, anyway.

In the first entry for this issue, I note that the command:

C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -dDebug -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\" -dSolutionDir=C:\Users\Autobuild\BUILD\WixBug\ -dSolutionExt=.sln -dSolutionFileName=WixBug.sln -dSolutionName=WixBug -dSolutionPath=C:\Users\Autobuild\BUILD\WixBug\WixBug.sln -dConfiguration=Debug -dOutDir=bin\Debug\ -dPlatform=x86 -dProjectDir=C:\Users\Autobuild\BUILD\WixBug\WixBug\ -dProjectExt=.wixproj -dProjectFileName=WixBug.wixproj -dProjectName=WixBug -dProjectPath=C:\Users\Autobuild\BUILD\WixBug\WixBug\WixBug.wixproj -dTargetDir=C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\ -dTargetExt=.msi -dTargetFileName=WixBug.msi -dTargetName=WixBug -dTargetPath=C:\Users\Autobuild\BUILD\WixBug\WixBug\bin\Debug\WixBug.msi -out obj\Debug\ -arch x86 Product.wxs

contains a double backslash at the end of the

-d"DevEnvDir ... "

option. Is this an issue?

There are also trailing backslashes on other paths specifying folders. These are generally valid, but they are still edge cases subject to suspicion.

How was the registry key in the project file created? was it typed into the project file by the user or created by an automated process?

The only distinction I saw between running Visual Studio elevated or not was that registry path validation was bypassed when the process was elevated. In this report, the claim is that the failure only occurs when the execution is elevated.

Are we fixing the wrong bug?

@cpuwzd
Copy link

cpuwzd commented Jan 24, 2021

No need to worry about squashing the commit history. I've redone my changes twice. Its probably been at least 20 years since I used VI, and I've never used VIm. When Vim popped up during a "git rebase -i", I lost it. I should have check the editor setting. (I still haven't.) I knew that the default setting was Vim, but I also saw references to notepad, which I thought might be the Windows default. I don't know if it is. Perhaps you overrode it.

Then I fixed everything up and watched a git reset eat my changes.

I finally got control of the situation on my third try.

I'm starting to feel a little more comfortable with running git with remotes. I'm certainly getting enough practice.

@robmen
Copy link
Member

robmen commented Jan 24, 2021

Those are quoted paths on the command line to candle, the trailing double backslash escapes the backslash so the quote isn't escaped. You can experiment with the same thing from a cmd prompt.

None of that has anything to do with the registry keys. The registry keys issue comes from developer mistakes and/or poor concatenation of need registry keys.

@robmen
Copy link
Member

robmen commented Jan 24, 2021

Learning git in a brand new personal repository is probably a lot easier than trying to work in something with as much history as the WiX Toolset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants