locked
Regenerating vb classes from xsd file RRS feed

  • Question

  • Hello everyone,

    I wrote a VB.NET app in which I imported a xsd schema definition.
    The very first time VisualStudio 2015 generated the related vb file with classes definitions and that was fine.
    Now I'd like to regenerate the vb file when I modify the schema structure insiede the VS.
    I found that if I define a 'Build Action' equal 'Content', I can generate something but:

    • if I don't define the 'custom tool' the VS does not generate anything
    • if I define 'Custom tool' as 'MSDataSetGenerator' it generate a file that does not contain the class definitions

    So, how can i generate the classes in the same manner as the 'xsd schema.xds /c' does ?
    Which other 'verbs' I can use as 'Custom tool' ?

    Thanks


    SteMMo


    Monday, March 12, 2018 9:06 AM

All replies

  • Hi SteMMo,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the VB.NET development. Since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum for a better support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, March 13, 2018 2:32 AM
  • Hello everyone,

    I wrote a VB.NET app in which I imported a xsd schema definition.
    The very first time VisualStudio 2015 generated the related vb file with classes definitions and that was fine.
    Now I'd like to regenerate the vb file when I modify the schema structure insiede the VS.
    I found that if I define a 'Build Action' equal 'Content', I can generate something but:

    • if I don't define the 'custom tool' the VS does not generate anything
    • if I define 'Custom tool' as 'MSDataSetGenerator' it generate a file that does not contain the class definitions

    So, how can i generate the classes in the same manner as the 'xsd schema.xds /c' does ?
    Which other 'verbs' I can use as 'Custom tool' ?

    Thanks


    SteMMo


    Hi SteMMo,

    You mean that you want to generate a code behind from .XSD file? If yes, you may take a look the following article:

    https://www.c-sharpcorner.com/blogs/generatingupdating-a-code-behind-from-xsd-file-in-visual-studio-2008

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 13, 2018 8:51 AM
  • If you don't know what custom tool was used to build it. Then it becomes a very difficult job.

    Success
    Cor

    Tuesday, March 13, 2018 11:29 AM
  • As I said in the original question, if I use the MSDataSetGenerator tool, VS generates a vb file that it is more larger and complex than the one generated by xsd tool.

    Furthermore my schema contains a parent tag from which some tags are derived; xsd generates that class but  MSDataSetGenerator not.


    SteMMo


    • Edited by SteMMo Tuesday, March 27, 2018 2:02 PM
    Tuesday, March 27, 2018 2:02 PM
  • So let us take the steps you take. 

    The normal way. Click on Build and it is rebuild. 

    Do you need changes click on the XSD and in the pane right click on a blue part and choose Config. 

    What do you do different?


    Success
    Cor

    Tuesday, March 27, 2018 3:15 PM
  • I'd only like to regenerate vb source when I modify the xsd schema and rebuild the project.

    What I noticed is that the generated sources are very different between 'custom tool' generation and the one generated by xsd.exe tool - and I prefer the latest source.

    Of course I could add a Prebuild step to launch (every time?) the xsd.exe tool but I'm wondering if it exist a 'Custom tool' to achieve the same result.


    SteMMo

    Wednesday, March 28, 2018 7:36 AM
  • .

    What I noticed is that the generated sources are very different between 'custom tool' generation and the one generated by xsd.exe tool - and I prefer the latest source.



    SteMMo

    Yea that is often. There've been more versions (I know at least 2) during the time .Net exist in the standard config way of the XSD.

    That is also when you write code and I write code. However, what is than the problem. f you look at the generated code for instance made by visual studio it is seldom in the way a programmer would do. But who cares. (Although if you had seen the first converter from VB6 to VB7, you never would complain anymore. At every row where almost 10 warning rows only made for legal reasons in the case something was done wrong). 


    Success
    Cor

    Wednesday, March 28, 2018 6:55 PM
  • Hello,

    I'm not a fan of generated classes in this fashion but if you want to regenerate classes open the Data Source window, select the database, right click and do configure. If there are changes in the database that are not reflected in your project there will be a yellow warning icon which you can pick and choose from or ignore. If say you had renamed a column in the table and have a user defined query this is picked up.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, March 28, 2018 9:01 PM