1
votes

When I run the below command from the command line for the WIx installer after migrated from version 2.0 to 4.0

E:\Code\PCPE\builder>ant -v -f Build.xml -Dlabel =.001 install

I am getting the below error:

error CNDL0004: The file element contains an unexpected attribute "src"

I am seeing the error in EMR_COMMON.wxs file in line no 4.

  1. Fragment>
  2. DirectoryRef Id="INSTALLDIR">
  3. Component Id="component_COMMON" Guid="" DiskId="1">
  4. File Id="file0_COMMON" Name="apcrun.exe" src="E:\Code\apcrun.exe"/>

I am thinking that "src" attribute is deprecated and it should be replaced with some other attribute.

But here i can't directly replace the "src" attribute in EMR_COMMON.wxs file bcz it is generating from "Build.xml".

So what are the attributes i need to change in "Build.xml" file to get the appropriate attribute inplace of "src" in "EMR_COMMON.wxs" file?

1
Yes, src is deprecated in favor of Source for File Elements (towards bottom). As to Build.xml, is that an Ant build script? Are you using Visual Studio, Eclipse, or something else?Stein Åsmul
You can add an answer from yourself and set it as accepted. So whoever has a similar issue can find it.Stein Åsmul

1 Answers

0
votes

I resolved the issue. I write the below C# code to replace "src" attribute name with "Source" attribute. For this first i got the "File" node list, get the count of the file nodes and then used XmlNodeList fileNodeList = compElement.GetElementsByTagName("File"); XmlElement fileElement = (XmlElement)fileNodeList[i]; String srcString = fileElement.GetAttribute("src"); fileElement.SetAttribute("Source", srcString); fileElement.RemoveAttribute("src");