Having difficulty using validator in VS Code
kew-dev opened this issue · 18 comments
Hi Mike! Thank you for answering my issue posted to the wrong repo. I think I am getting closer, because I can now right click and see the Validate OOXML.
When I attempt to validate a DOCX, I get the error regarding Microsoft.NetCore.App version 6.0.0 not found. I have installed the .Net Core 3.1 runtime (https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-3.1.30-windows-x64-installer?cid=getdotnetcoreJ) as well as the .NET Install Tool for Extension Authors. But I still must be missing something. Do I need to install .Net 6.0 from https://dotnet.microsoft.com/en-us/download/dotnet ? Also, I am not sure which specific file to use for the absolute path in the extension's settings. Any pointers will be appreciated! Thanks
You shouldn't need to install .Net 6.0, but it won't hurt either. If you have the .NET Install Tool for Extension Authors installed then if you don't set any value for ooxml.dotNetPath
the extension will download the runtime itself, although this takes longer than if you have it on your system.
The file you need for the absolute path is dotnet.exe. Where it is will vary depending on your OS and setup. I'm using Windows 11 and my path is "C:\\Users\\<username>\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-dotnettools.vscode-dotnet-runtime\\.dotnet\\3.1.23\\dotnet.exe"
.
Does it work if you don't add ooxml.dotNetPath
?
From the error it looks like it's looking for a different version of .Net. Have you tried installing the .Net version from the link in the error?
On the other PC where I just tried a fresh install of the extension, I do not have the ooxml.dotNetPath entered in settings.
It's hard to tell from the error message what URL it's directing me to. On the first PC, I tried installing this runtime, but that didn't help:
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-6.0.2-windows-x64-installer
Thanks again.
What is the result of running dotnet --list-runtimes
from PowerShell?
On the first PC:
Microsoft.NETCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
On the 2nd PC:
Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Does "C:\Program Files\dotnet\dotnet.exe" exist on your PC?
If it does, try setting "ooxml.dotNetPath": "C:\\Program Files\\dotnet\\dotnet.exe"
. in your settings.json.
I'm glad you got it working at least on one PC! When you get the error, are you trying to use the validator on a .csv file?
It turns out I had set an absolute path of "C:\Temp" for the output file path. I cleared that setting and it is running the validation successfully now. Thank you!
Now that I have it working, is there any guidance on how to interpret or filter out the validation errors? I realize that some of the errors such as "Sch_InvalidElementContentExpectingComplex" are most likely benign. I am hoping to use the tool to determine the cause of certain DOCX files not being able to open in Word due to malformed OOXML, so I need to be able to sift out the benign warnings and if possible find the one piece of bad OOXML that causes the document to not open in Word.
As far as I know, none of the errors are benign. "Sch_InvalidElementContentExpectingComplex" indicates that an element has invalid content, which likely would cause the whole document to be invalid. I contribute to another extension that allows viewing, editing, change tracking etc. for OOXML files. It could help view the underlying xml and see what the invalid content is.
https://marketplace.visualstudio.com/items?itemName=yuenm18.ooxml-viewer
Thanks. For the output file path, what would you suggest? Using C:\Temp caused an error previously, so do I need to create a blank .csv file so the absolute path includes a file name?
You don't need to create the file first, it just needs to be in a folder that VS Code can write to. As long as VS Code has write access it should work. Here's how you change folder permissions:
Thank you - adding a csv file name to the absolute path worked fine. Appreciate all your help!!!
Awesome! Since it's working for you, I'll go ahead and close this issue 😃
@mikeebowen This issue still seems to be present. My computer is an Ubuntu machine, so I installed VSCode, https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-runtime and this validator on a clean VirtualBox Windows 10. And it gave me the same error about the wrong version being loaded.
@johanneswilm Does it work if you set ooxml.dotNetPath
?
@mikeebowen Yes, I got it to work by manually installing version 6.0.0 and then setting the setting.
The point is that the instructions don't work as it will install version 3.2.1 of the .net runtime and then subsequently throw an error about needing version 6.0.0.