wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 24 forks source link

LGHT0001 should be more specific about *which* file failed. #5417

Closed Daniel15 closed 2 years ago

Daniel15 commented 8 years ago

I have a directory containing thousands of files. I'm using the HeatDirectory MSBuild task in my wixproj file:

    <HeatDirectory
      AutogenerateGuids="true"
      ComponentGroupName="MyAppFiles"
      Directory="$(MyAppDistPath)"
      DirectoryRefId="INSTALLDIR"
      OutputFile="generated.wxs"
      PreprocessorVariable="var.MyAppDistPath"
      SuppressRootDirectory="true"
      ToolPath="$(WixToolPath)"
    />

This was working, but now I'm getting this error:

Project "C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj" on node 1 (default targets).
BeforeBuild:
  C:\Program Files (x86)\WiX Toolset v3.10\bin\Heat.exe dir ..\..\dist -cg MyAppFiles -dr INSTALLDIR -srd -var var.MyAppDistPath -ag -out generated.wxs
  Windows Installer XML Toolset Toolset Harvester version 3.10.3.3007
  Copyright (c) .NET Foundation and contributors. All rights reserved.

Compile:
  C:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe -dMyAppDistPath=..\..\dist -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x86 -dProjectDir=C:\src\MyApp\resources\winsetup\ -dProjectExt=.wixproj -dProjectFileName=MyAppSetup.wixproj -dProjectName=MyAppSetup -dProjectPath=C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj -dTargetDir=C:\src\MyApp\resources\winsetup\bin\Release\ -dTargetExt=.msi -dTargetFileName=MyApp.msi -dTargetName=MyApp -dTargetPath=C:\src\MyApp\resources\winsetup\bin\Release\MyApp.msi -out obj\Release\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.10\bin\\WixUIExtension.dll" generated.wxs MyApp.wxs
  Windows Installer XML Toolset Compiler version 3.10.3.3007
  Copyright (c) .NET Foundation and contributors. All rights reserved.

  generated.wxs
  MyApp.wxs
Link:
  C:\Program Files (x86)\WiX Toolset v3.10\bin\Light.exe -out C:\src\MyApp\resources\winsetup\bin\Release\MyApp.msi -pdbout C:\src\MyApp\resources\winsetup\bin\Release\MyApp.wixpdb -cultures:null -ext "C:\Program Files (x86)\WiX Toolset v3.10\bin\\WixUIExtension.dll" -contentsfile obj\Release\MyAppSetup.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\MyAppSetup.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\MyAppSetup.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj obj\Release\generated.wixobj obj\Release\MyApp.wixobj
  Windows Installer XML Toolset Linker version 3.10.3.3007
  Copyright (c) .NET Foundation and contributors. All rights reserved.

light.exe : error LGHT0001: The file cannot be accessed by the system. [C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj]

  Exception Type: System.IO.IOException

  Stack Trace:
     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
     at Microsoft.Tools.WindowsInstallerXml.Binder.UpdateFileRow(Output output, IDictionary`2 infoCache, String modularizationGuid, Hashtable fileRowIndex, FileRow fileRow, Boolean overwriteHash)
     at Microsoft.Tools.WindowsInstallerXml.Binder.UpdateFileInformation(Output output, FileRowCollection fileRows, MediaRowCollection mediaRows, IDictionary`2 infoCache, String modularizationGuid)
     at Microsoft.Tools.WindowsInstallerXml.Binder.BindDatabase(Output output, String databaseFile)
     at Microsoft.Tools.WindowsInstallerXml.Binder.Bind(Output output, String file)
     at Microsoft.Tools.WindowsInstallerXml.Tools.Light.Run(String[] args)
Done Building Project "C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj" (default targets) -- FAILED.

Build FAILED.

"C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj" (default target) (1) ->
(Link target) ->
  light.exe : error LGHT0001: The file cannot be accessed by the system. [C:\src\MyApp\resources\winsetup\MyAppSetup.wixproj ]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:04.29

It seems like it's failing at Binder.cs:6271, but since it doesn't specify which file failed, this is very hard for me to debug. I'm sure it's one of the files in my Heat run, because the error goes away once I remove the ComponentGroupRef that points to it.

Which version of WiX are you building with?

3.10.3.3007

Which version of Visual Studio are you building with (if any)?

Visual Studio 2015, MSBuild 14.0

Which version of .NET are you building with?

.NET Framework 4.6.2

rseanhall commented 8 years ago

We need to add a try catch block to make sure the file name gets into the error message.