MSDataSetGenerator Has Gone Wacko
-
Wednesday, June 13, 2012 6:21 PM
In the past, I've not had any problems generating a Typed DataSet from my .xsd. (I'm using VS 2010). The project is set to .NET 4, but the MSDataSetGenerator refuses to generate TypedTableBase in the Designer.cs file (still using DataTable). I've tried everything ... deleting the Designer.cs, right-clicking the .xsd in the solution and "Run Custom Tool", deleted MSDataSetGenerator from the CustomTool property and then adding it back in, etc.etc.etc. Nothing works, it keeps generating DataTables instead of the proper TypedTableBase. WTF could be wrong? I've even rebooted my computer, thinking I had too much stuff going on at once (which I did) ... but that didn't help.
Any suggestions for other tricks I could try?
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com
All Replies
-
Wednesday, June 13, 2012 7:33 PMI should probably also mention that this all worked fine last week. I'm running Win XP ... I wonder if there was a recent Windows Update that might have screwed things up?
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
Thursday, June 14, 2012 10:21 AM
Hi BonnieB
did you see the answer to this post? (you were in it too)
Apparantly it's a hidden feature.
Regards, Nico
- Edited by Nico Boey Thursday, June 14, 2012 10:23 AM
-
Thursday, June 14, 2012 2:40 PM
Yeah, Nico ... I saw that earlier, before I posted my question here. If you read my last reply there, you'll see that I only half-agree with Garfield ... at the time, I couldn't reproduce what he said: old-style DataSets using DataTable (the problem I'm currently having is producing those when I don't want them).
My experience (until yesterday!!) has been that you can produce new-style and old-style (depending on whether you generate from the Designer or from the .xsd) ... but that "style" is based on whether or not the TableAdapters got generated. The TypedTableBase was still generated in both scenarios. AFAIK, the only time it's supposed to generate DataTable is if your project targets .NET 3.0 or lower. .NET 3.5 and above should generate TypedTableBase.
I have been doing it the same way for years and never had this problem. Something in my environment has changed and I'm trying to figure out what that is. It worked fine last week.
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com- Edited by BonnieBMVP Thursday, June 14, 2012 2:47 PM
-
Friday, June 15, 2012 5:10 AM
Holy cow! This is strange! I typically add a DataSet by doing the following:
- Copy an existing .xsd file to my project's folder.
- Right-click the project in Solution Explorer and "Add Existing", choosing the .xsd
- Add the MSDataSetGenerator to the Custom Tool property if necessary.
- Generate the Typed DataSet
... I've been doing it this way for years (but haven't always been paying attention to what gets generated, because I haven't typically used LINQ with the DataSets until recently).
Someone mentioned to me that I should try adding DataSets a different way. Instead of "Add Existing", I should "Add New Item" and choose a DataSet item. Then I can copy/paste the xml into it. I tried that in my current problem project and guess what ... it generated the TypedTableBase! And, lo and behold, the DataSet that refused to generate TypedTableBase was now doing it correctly too!! Weird!!
So, I decided to test it in a brand new project. I closed the solution (but did not close VS). Created a new solution/project, copied an .xsd file, "Add Existing", generate ... still TypedTableBase (I was expecting it to be DataTable, since I didn't "Add New Item", DataSet). Hmmm ... maybe it was because I didn't start with a fresh Visual Studio? I shut it down, started up VS again, went through the process a second time with a brand new solution and created the DataSet with "Add Existing" ... this time ... DataTable, as I now expected it to do.
And again, as soon as I did "Add New Item", DataSet ... both DataSets again generated TypedTableBase.
But wait ... there's more! As soon as I shut down Visual Studio and started it up again, the DataSets again revert to generating DataTables instead of TypedTableBase (until I "Add New Item", DataSet, then it's fine again).
Sounds like a major bug to me .... anyone else see this behavior?
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
Tuesday, June 19, 2012 2:29 AMWith such a weired scenario, what I can suggest is re-install VS, you may have some other software installed or some settings make it not work.
Go go Doraemon!
-
Tuesday, June 19, 2012 2:36 PM
You might be right ... I assume that means that you're not seeing the same behavior?
In any case, I think I'll just put up with it for now. I don't re-gen my DataSets all that much and I really don't want to have to re-install VS just for this little glitch.
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
Tuesday, June 19, 2012 3:40 PM
Bonnie,
I miss the simple "configure" in the right click on the XSD, to be sure I ask if you did that, I saw that you are not always using strongly typed datasets and you are then not the first one who misses this simple way.
It regenerate your complete XSD
Success
Cor -
Tuesday, June 19, 2012 4:14 PM
Cor,
I don't see any "configure" ... maybe it's a VB vs C# thing? Anyway, I think you misunderstood what I was saying. I always use Typed DataSets ... I've been a big advocate of Typed DataSets for 10 years!! It's just that my current apps have mature DataSets and don't often need to be changed, hence there's not many times that I need to re-gen them.
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
Tuesday, June 19, 2012 4:24 PM
No I tried it in C# even to show you it with snipping tool, but as it is a right click that closes as soon as I start the snipping tool and to make for this. I've to go tonight (here it is 18:30 now) but I try it so wait a moment. Maybe I succeed.
Success
Cor -
Tuesday, June 19, 2012 4:28 PM
No same problem, however look at this.
With the XSD visible you can click Data and then Configure or Right click on that Employee table and do configur, then the wizard shows up. If you finish that until the end then the XSD is made new.
Success
Cor
- Edited by Cor LigthertMVP Tuesday, June 19, 2012 4:29 PM
- Edited by Cor LigthertMVP Tuesday, June 19, 2012 4:30 PM
-
Tuesday, June 19, 2012 4:32 PMOh, in the Designer! I never use the Designer, because using it causes TableAdapters to be generated and I don't like and don't use TableAdapters! I add stuff to my DataSet simply by editting the xml in the .xsd.
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com -
Tuesday, June 19, 2012 4:32 PM
Ahh, I think I got it, you have to double click first on the XSD to bring it in the designer like you see in my previous message.
You can not do it direct from solution explorer.
Success
Cor- Edited by Cor LigthertMVP Tuesday, June 19, 2012 4:35 PM
-
Tuesday, June 19, 2012 4:38 PM
Yea but those older tools have as far as I remember me already for years problems.
:-)
Success
Cor -
Tuesday, June 19, 2012 4:46 PMI guess I'm just old-fashioned! ;0)
~~Bonnie Berent DeWitt [C# MVP]
geek-goddess-bonnie.blogspot.com

