问题
When I am migrating Wix 3.0 to Wix 4.0 using WixCOP I am getting the error WXCP0006 : The whitespace preceding this node is incorrect (WhitespacePrecedingNodeWrong)
I am running the below command
WixCop.exe -f E:\Test\Wix\src\UI*.wxs.
When i run the same command to migrate from Wix 2.0 to Wix 3.0 i didn't get any errors.
UPDATE: Thank you for the detailed information.
1) I run the below command multiple times and getting the same errors.
WixCop.exe -f E:\Test\Wix\src\UI*.wxs.
2) I am seeing the changes in the .WXS files (namespace and other changes) after I run that command
3) I wanted to know how to configure the incorrect white space ( I mean which file in wix40-binaries bcz i have seen few .config files but those are are not related to wixcop)
And also in which file i can suppress the command "WhitespacePrecedingNodeWrong" ?
When i was migrating from wix 2.0 to wix 3.0 initially i got the whispace errors. Then when i run the below Fix errors command those errors were resolved WixCop.exe -f E:\Test\Wix\src\UI*.wxs.
But when migrating from wix 3.0 to wix 4.0 why this command is not resolving these errors?
回答1:
UPDATE2: Maybe you can log the results per file better - to see what breaks. Here is one proposal (I have long tried to forget about batch files, so pardon any lacking elegance. No guarantees for the sanity herein):
for %h in (*.wxs) do wixcop -f "%h" -set1Test.xml >> Log.log
Where
Test.xml
is the settings file described in a section below. Or run without the settings file:for %h in (*.wxs) do wixcop -f "%h" >> Log.log
Obviously be careful with the above commands! They will target all WiX source files in the target folder - which in your case is what you want, but for others who find the command lines: caution.
UPDATE:
Pinpoint: Could you try to run the command on a sub-set of the files or once per file so you can determine which file causes the actual problem? Another way to find this might be to run on all files (use your current wildcard approach) and then see what files have not been updated?
Unchanged Files?: As I said above, please try to determine what files have not been updated. If any. Unchanged files may trigger errors that abort the update operation?
Suppress Errors: I don't know of any sample settings files apart from what is found in the documentation I linked to earlier. Let's try to build a simple settings file to ignore two types of errors:
File Name: Test.xml <Settings> <IgnoreErrors> <Test Id="WhitespacePrecedingNodeWrong" /> <Test Id="WhitespacePrecedingEndElementWrong" /> </IgnoreErrors> </Settings> Command Line To Use: wixcop.exe -f Product.wxs -set1Test.xml
Resolution: Short answer is I don't know why you have unresolvable problems this time. As stated, please try to narrow down the problem to a single file - or group of files - if possible using the suggestions above.
Correction, New Rectification Follows (practicing tautologies): If you run the command again on the same file(s), are the errors gone? It seems the WiX file is still updated (so far as it is writable) - despite the error messages - and what happens is that the process fixes indentation and line feed inconsistencies (among other things) so the source file complies with the WiX standard (or your own standard) afterwards.
Setting The Standard: What you see is an error stating that there are white space inconsistencies in your source file. This could be a mere errornous number of indentations - for example. According to Bob Arnson's
WiX Cop piece here: http://www.joyofsetup.com/2008/03/26/wix-goodies-wixcop the detection of incorrect white space is configurable - as are many other parameters for other checks beyond white space. You need to provide settings files and define the right command line switches to set your own standard. You might want to suppress some tests and fixes for example. There is a brief sample of a settings file in the online documentation link below.
WiXCop.exe: I won't repeat all the details here, please see Arnson's post above, or run wixcop /?
via command line to get a list of available command line switches (WiX must be installed of course, and you need the WiX Bin directory
in the path). You can also see all switches in the WiX online documentation for WiXCop.exe.
I guess the overall summary is that WiXCop.exe
extends normal MSI file validation a step further by validating the WiX XML source file directly before compilation to MSI format. And it helps migrate sources when batch updates are required for schema changes between WiX versions.
I am a bit surprised there is no auto-backup feature for the WiX XML update process. I guess there is a good reason why this is not done. Make a backup of your source files before running WiXCop and then compare with a good diff tool. I use Beyond Compare.
来源:https://stackoverflow.com/questions/52055863/when-migrating-wix-3-0-to-wix-4-0-getting-error-wxcp0006-the-whitespace-prec