Generate vb class from xsd. xmldsig#:SignatureType - vb.net

I'm trying to generate a vb.net class using the xsd tool, from a xsd file, but I receiving the following message:
schema validation warning: complext type 'http://www.w3.org/2000/09/xmldsig#:SignatureType
Warning: cannot generate classes because no top-level element with complex type were found.
Thanks!
Davis

better late than never...
You have to pass 2 parameters. Your file, and the http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd reference. As XSD.exe only accepts 1 input parameter, you have to pass it .Xsd paths.
So, you have to do this:
Download xmldsig-core-schema.xsd schema.
Run this:
"C:\Program Files\Microsoft SDKs\Windows\vXXXX\bin\xsd.exe"
[path_your_folder]\your_file.xsd
[path_to_your_folder]\xmldsig-core-schema.xsd /c /n:mi_new_class_file_name /l:VB
The new file "mi_new_class_file_name.vb" may be now into your "C:\Program Files\Microsoft SDKs\Windows\vXXXX\bin" folder.

I had similar problems with XSD.EXE, it would work for some simple XSDs, but anything complex - bunch of various errors and that is. What made problem worse, I am fairly amature with XSD/WSDLs. In my experience, i had several WSDLs, each imported 2 to 5 external XSD.
Here is what I did to get Classes from XSD:
-Download and install free tool XSD2CODE
-Run in command line:
"<PATH to Xsd2Code executable>\Xsd2Code.exe" YourXSDFile.xsd /l vb
That generated classes for me even when XSD.EXE could not.
Good Luck!

Related

mt.exe -replacements: xml file structure for registration free COM component is not documented

I am using mt.exe to generate a manifest for a registry free C++ COM component. The .rgs file passed on the command line has some replaceable strings whose value must be stored in a .xml file passed to the -replacements argument. The thing is, there is no documentation on the expected syntax for that xml file. I reported the issue to Microsoft but the ticket was closed without providing any solution. Does any one know how the replacement xml file should be structured?

Get AST Nodes of objective-C class without resolving dependencies

I am trying to create a refactoring tool that would allow me to get a syntax tree from an objective-c class so that I can change the structure of the class and output a different version of it that matches my criteria. I am looking at Clang's Libtooling to generate an AST and then take it from there, the issue I'm having is that I need to somehow make sure I provice all paths to all possible headers that are being imported from this source, and that's something I'd like to avoid.
I am wondering if there is a way to generate the AST for a class without having to for example provide paths for the framework containing the class definitions of the properties that the class I wanna refactor hold.
Ideally I would be able to get nodes in raw text of my source file containing things like properties, functions, etc... this way I'd be able to traverse that tree and change its structure to later on regenerate my source in the desired way.
After doing more research I deveoped the understanding that what I was trying to do is not even possible as LibTooling based tools need syntactic and semantic information about a program. This information can be provided via a compile_commands.json file like stated on the documentation:
Clang Tooling needs a compilation database to figure out specific build options for each file. Currently it can create a compilation database from the compile_commands.json file
For Xcode projects, this file can be generated like this:
xcodebuild -project PROJECT_NAME.xcodeproj | xcpretty -r json-compilation-database --output compile_commands.json
you will need to install the xcpretty gem. (gem install xcpretty)
Source: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html

Generating new .xml files for Intellisense does not include remarks

I'm trying to have Sandcastle generate .xml files that can be used for intellisense with my solution, that contains a lot of different projects.
To do this, I enabled the IntelliSense component, and it seems to kind of work: it at least removes all private and internal members, which Visual Studio does not do by default, as I'm not generating documentation for anything but public members.
However, all the generated .xml files have lost the remarks section the .xml files have originally. Is there a way to preserve this information in Sandcastle with this component?
I ended up writing a tool to merge the additional info back into the xml file for IntelliSense.

Is there a utility to create VB.NET classes from an XSD file?

Is there a utility out there that will create VB.NET classes from a Dataset.xsd file? And I don't mean like the XSD.exe utility does - all that does is convert the XML of an XSD file into classes in a .vb - it doesn't append any "extended" functionality.
I'm basically looking for something that will generate the beginnings of a business layer from the XSD file. Like creating a partial class for each datatable, then create a property for each of the datatable's columns as the right datatype and finally the basically CRUD methods as well.
This is something I have to do manually over and over again for each project. (I do lots of little projects and use VistaDB so I can't use Linq-To-SQL - wish I could)
I think that xsd.exe will do what you need it to. Here's and example to convert purchaseorder.xsd to a vb class in the Purchasing namespace:
xsd.exe -c -l:vb -n:Purchasing purchaseorder.xsd
Type xsd.exe /? from a visual studio command prompt to get all of the options.
You can find more info here.
Try taking a look at T4 and Code Generation tools in Visual Studio. It's like "writing code that writes code", and it's incredibly powerful.
A great video, really an "aha experience" for me
http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx
MSDN:
http://msdn.microsoft.com/en-us/library/bb126445.aspx
Rob Conery has written an intro:
http://blog.wekeroad.com/blog/make-visual-studio-generate-your-repository/
... and so did Scott Hanselman:
http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx
I understand it's probably not exactly what you're hoping for, but when you want more flexibility and NOT having to write the same code over and over again, it really sounds like T4 could be a solution.
You'll write a template, that analyses your XSD file and generates the vb files directly in your project.
I know this doesn't strictly answer the question, but it looks like VistaDB either does, or will soon, have a provider that can be used with Linq to Entities - see here
Liquid studio XML Data Binder looks like it does what you want and has a 30 day trial you can download.

Problem with dynamically generated C# files in msbuild

I have a source XML file that is used to create C# files that are then compiled as part of a project.
Currently I have a BeforeBuild target that runs my XML to C# converter.
The problem is that by the time the BeforeBuild step is run the old files appear to have been stored by the build system so the new files are ignored.
How can I get around this? It seems that Transforms would be the way but they are limited in what they can do.
I guess your "stored by the build system" can be translated as the ItemGroup containing the .cs files you wish to compile is generated when the msbuild file is read, as opposed to when your compile target is executed. You have several options:
<CreateItem> see CreateItem task
<Output> see Output element
I hope this helps.
Well we have something similar-ish here. We gen a .cs off an xml file using a .tt. Both files are part of a specific csproj. Going properties->BuildEvents on the csproj gives this little snippet in the Pre-build event command line:
del "$(ProjectDir)MyCsFile.cs"
copy /b /y "$(ProjectDir)\MyXmlFile.xml" "$(TargetDir)"
"$(ProjectDir)tt.bat" "$(ProjectDir)MyTemplateFile.tt"
No idea if that's of any use to you, I hope it might suffice as a last chance workaround.
I think you need to show us a little of your rule/build file. You should have a rule/dependency for the cs file that has the xml as the dependency.
I am not sure what you mean by "stored by the build system"
Check your rules carefully for errors/omissions.