I am trying to use the tool XSD.EXE to generate some class files from an XSD. Whether there is anything to be gained from the resulting files is another question, but I would like to see what is generated. I found this reference, which notes:
Which, thanks to Luke over on the F# Visual Studio team, means I can do this:
xsd.exe fpml-asset-4-z.xsd /classes /l:”Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider, FSharp.Compiler.CodeDom, Version=22.214.171.124, Culture=neutral, PublicKeyToken=a19089b1c74d0809″
Which is splendid. I don't have the same version of the code dom - so looking at the GAC I changed the line to:
xsd.exe RIXML-datatypes-2_3_1.xsd /classes /l:"Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider, FSharp.Compiler.CodeDom, Version=2.0.0,0, Culture=neutral, PublicKeyToken=a19089b1c74d0809"
C:\Users\Desktop\CSharpSamples\ResearchUploader\Fc-RixmlLib>xsd.exe RIXML-datatypes-2_3_1.xsd /classes /l:"Microsoft.FSharp.Compiler.CodeDom.FSharpCodePr ovider, FSharp.Compiler.CodeDom, Version=2.0.0,0, Culture=neutral, PublicKeyToken=a19089b1c74d0809" Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation. All rights reserved. Error: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
If you would like more help, please type "xsd /?".
I had the same problem "Exception from HRESULT: 0x80131047" - did not manage to solve it but there is an ugly workaround:
Spent an hour trying to get xsd.exe to work, and it took me only 5 mins to bruteforce it this way..
This could be easily made into xsdfs.exe or something to save people the trouble of making xsd.exe to use the f# code dom :)
That looks correct to me. Can you double check that the assembly is installed in GAC?
Here is a command that you can enter to "Visual Studio Command Prompt":
> gacutil -l | find "FSharp.Compiler.CodeDom"
FSharp.Compiler.CodeDom, Version=126.96.36.199, Culture=neutral, PublicKeyToken=a19089b1c74d0809, processorArchitecture=MSIL
Leave off the
Microsoft part, and after you installed to GAC, it should work. They changed names a while back.
I can, after installing (disassemble and assemble - ildasm, gacutil fun) use both
xsd.exe and the in-editor C# method (rewriting to F#). Thanks :)
User contributions licensed under CC BY-SA 3.0