0

I just upgraded from VS 2015 to VS 2019 (and Windows 7 to Windows 10). My project is using SQLMetal.exe and msxsl.exe in a batch file to create and modify the DBML in three steps:

  1. Generate the DataModel.dbml file with SQLMetal.exe.
  2. Add database transforms with msxsl.exe.
  3. Generate the DataModel.cs file with SQLMetal.exe.

When I ran this in the new environment, it gave me a strange error:

DataModel.dbml(0) : Error: DBML1112: Element 'Column" must be empty, but contains a node of type Whitespace named ''.

After much trial and error, I realized that the msxls.exe (that I just downloaded) adds carriage returns before the closing column and association tags in the DBML file. This seems to be what is causing the error on the final SQLMetal.exe step.

<Column Name="SortOrder" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false">
</Column>

I can actually open the DataModel.dbml file after step 2 and replace all on "\r\n < /Column>" to "< /Column>" and "\r\n< /Assocation>" to "< /Association>", and then Step 3 seems to work. Obviously, I don't want to have to do this every time, though.

So, what do I need to do to run msxsl.exe and not have it add the carriage returns before the closing Column and Association tags?

The msxls command is as follows:

"C:\VSBuild\msxsl.exe" "%~dp0DataModel.dbml" "%~dp0ModifyDbml.xslt" -o "%~dp0DataModel.dbml"

Does the version of msxsl matter?

John Pasquet
  • 1,824
  • 15
  • 20
  • Since you've not shown us your `msxsl` command, we're guessing - but perhaps adding the `-xw ` option may assist. – Magoo Jun 17 '19 at 19:23
  • @Magoo I added the command above. Appending "-xw" on it didn't seem to help. – John Pasquet Jun 17 '19 at 19:36
  • I'll freely admit to being as far from an expert with `msxsl` as it is possible to be, but I'd try three things : First, restore the older version of `msxsl` from your copious backups; second, reduce the name `sortorder` to a shorter string and if neither of these work, then use a utility like `sed` or `(g)awk` to dispose of the unwanted newline. – Magoo Jun 17 '19 at 21:27

0 Answers0