I am new to stack overflow and to Wix so please bear with me.
I am using Wix38 in Visual Studio2012 on a x64 laptop. I am trying to create an x86 installer but some of the files that I am trying to add are failing to build with a LGHT0103 system cannot find file error.
My Wix code to add the files is as follows:
<Fragment>
<ComponentGroup Id="DesktopComponents" Directory="INSTALLFOLDER">
<Component Id="CMPExecutable" Guid="{E84BF717-9B73-439F-B8D2-1E2C2E5FA204}">
<File Id="FILEexecutable" KeyPath="yes" Source="$(var.PaddockDesktop.TargetDir)PaddockDesktop.exe" />
</Component>
<Component Id="CMPEnityframework" Guid="{596A608E-53AA-4131-92F3-5B1EA065AEC9}">
<File Id="FILEentityframework" KeyPath="yes" Source="$(var.PaddockDesktop.TargetDir)EntityFramework.dll" />
</Component>
<Component Id="CMPMahapps" Guid="{2434F3AF-00C0-4363-9DCD-D631656D275D}">
<File Id="FILEMahapps" KeyPath="yes" Source="$(var.PaddockDesktop.TargetDir)MahApps.Metro.dll" />
</Component>
<Component Id="CMPinteractivity" Guid="{1179CC18-8BD6-42D0-AE4D-35FB6B4F5750}">
<File Id="FILEinteractivity" KeyPath="yes" Source="$(var.PaddockDesktop.TargetDir)System.Windows.Interactivity.dll" />
</Component>
</ComponentGroup>
</Fragment>
The error is shown in the build output as:
C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\\" -dSolutionDir=G:\aa\ -dSolutionExt=.sln -dSolutionFileName=PaddockDesktop.sln -dSolutionName=PaddockDesktop -dSolutionPath=G:\aa\PaddockDesktop.sln -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x86 -dProjectDir=G:\aa\PaddockSetup\ -dProjectExt=.wixproj -dProjectFileName=PaddockSetup.wixproj -dProjectName=PaddockSetup -dProjectPath=G:\aa\PaddockSetup\PaddockSetup.wixproj -dTargetDir=G:\aa\PaddockSetup\bin\Release\ -dTargetExt=.msi -dTargetFileName=PaddockSetup.msi -dTargetName=PaddockSetup -dTargetPath=G:\aa\PaddockSetup\bin\Release\PaddockSetup.msi -dPaddockDesktopService.Configuration=Release -d"PaddockDesktopService.FullConfiguration=Release|x86" -dPaddockDesktopService.Platform=x86 -dPaddockDesktopService.ProjectDir=G:\aa\PaddockDesktopService\ -dPaddockDesktopService.ProjectExt=.csproj -dPaddockDesktopService.ProjectFileName=PaddockDesktopService.csproj -dPaddockDesktopService.ProjectName=PaddockDesktopService -dPaddockDesktopService.ProjectPath=G:\aa\PaddockDesktopService\PaddockDesktopService.csproj -dPaddockDesktopService.TargetDir=G:\aa\PaddockDesktopService\bin\x86\Release\ -dPaddockDesktopService.TargetExt=.exe -dPaddockDesktopService.TargetFileName=PaddockDesktopService.exe -dPaddockDesktopService.TargetName=PaddockDesktopService -dPaddockDesktopService.TargetPath=G:\aa\PaddockDesktopService\bin\x86\Release\PaddockDesktopService.exe -dPaddockDesktop.Configuration=Release -d"PaddockDesktop.FullConfiguration=Release|x86" -dPaddockDesktop.Platform=x86 -dPaddockDesktop.ProjectDir=G:\aa\PaddockDesktop\ -dPaddockDesktop.ProjectExt=.csproj -dPaddockDesktop.ProjectFileName=PaddockDesktop.csproj -dPaddockDesktop.ProjectName=PaddockDesktop -dPaddockDesktop.ProjectPath=G:\aa\PaddockDesktop\PaddockDesktop.csproj -dPaddockDesktop.TargetDir=G:\aa\PaddockDesktop\bin\x86\Release\ -dPaddockDesktop.TargetExt=.exe -dPaddockDesktop.TargetFileName=PaddockDesktop.exe -dPaddockDesktop.TargetName=PaddockDesktop -dPaddockDesktop.TargetPath=G:\aa\PaddockDesktop\bin\x86\Release\PaddockDesktop.exe -out obj\Release\ -arch x86 Product.wxs
C:\Program Files (x86)\WiX Toolset v3.8\bin\Light.exe -out G:\aa\PaddockSetup\bin\Release\PaddockSetup.msi -pdbout G:\aa\PaddockSetup\bin\Release\PaddockSetup.wixpdb -cultures:null -contentsfile obj\Release\PaddockSetup.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\PaddockSetup.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\PaddockSetup.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile G:\aa\PaddockSetup\PaddockSetup.wixproj obj\Release\Product.wixobj
G:\aa\PaddockSetup\Product.wxs(41,0): error LGHT0103: The system cannot find the file 'G:\aa\PaddockDesktop\bin\x86\Release\MahApps.Metro.dll'.
The file MahApps.Metro.dll is indeed at the location referenced. The other three files seem to be added correctly and are at the same location as the file which is causing the error.
I have looked at other stackoverflow questions: Wix project error in TFS build which shows a problem similar to mine. I did not understand the TFS solution that was provided and my path length is by far less than 255 characters. There is this other link WiX unable to load file, error LGHT0103 . The solution seems easy but I couldn't figure out how to change $(var.PaddockDesktop.TargetDir) into sys.SOURCEFILEDIR.
I cant understand why some files from the same folder would be added and others will not be added even though they are in the same folder.
Please Note : PaddockDesktop is a WPF project in the same solution as the Wix installer. It is targeting x86 CPU.
Thank you for your assistance in advance.