Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sunday, January 2, 2011 5:02 PM | 1 vote
Hi
i'm facing a critical problem!
today, when i open my dataSet in dataSet designer and make any change and then save it, it generate new dataset.designer1.cs file instead writing to my original dataSet.designer.cs file. hence, it mades me rollback my changes.
can anybody help me why this problem occures and how to solve this?
(also i found this link, but i don'r know how to accomplish this and i think it does not strightforward way!)
thanks in advance
http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx
Wednesday, January 5, 2011 12:40 PM ✅Answered
Hi Hamed_1983,
Have you tried the suggestion in Vladimir.Ilic's reply?
Has this question been solved?
If there's any concern, please feel free to let me know.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Hi Mike and Thanks Vladimir
i've followed the second way in our project, i found 2 places which used myDataSet1.designer.cs in my project file, when i rename all to myDataSet.designer.cs and reopen my project, the i have 2 myDataSet.designer.cs file and when i delete the second one, the first one has been deleted too!
but when i open my project without source control or offline mode (at my home), i found only 1 myDataSet1.designer.cs file in my project file, when i rename it and reopen my app, myDataSet1.designer.cs file excluded from my project correctly. then i remove it from my application folder without any problem. i don't know how my problem has been solved, but now, it works correctly!
anyway, Many thanks everybody
http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx
Sunday, January 2, 2011 9:58 PM
AFAIK that happens when, for some reason designer cannot write to the original designer.cs file.
Not sure what the reason may be, if the file got locked somehow by VS or some other process, or checkout command from source control failed, or file is read-only ...
Anyway, you have the solution to your problem in the thread you posted, i used it more than once to correct the issue. Which step do you have trouble with ?
// Vladimir
Monday, January 3, 2011 7:42 AM
AFAIK that happens when, for some reason designer cannot write to the original designer.cs file.
Not sure what the reason may be, if the file got locked somehow by VS or some other process, or checkout command from source control failed, or file is read-only ...
Anyway, you have the solution to your problem in the thread you posted, i used it more than once to correct the issue. Which step do you have trouble with ?
// Vladimir
Hi
Yes, i have trouble in my link :
1. exclude DataSet designer from project : which dataSet designer ?(myDataSet.xsd ? myDataSet.cs ? myDataSet.Designer.cs ? or some other else files ?)
3. remove Designer.cs from disk (if it exists) : if i remove myDataSet.Designer.cs, i don't have any dataSet. hence, i can not follow step 6,7.
can u describe more information about this steps or give me a full guidance ?
thanks in advance
http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx
Tuesday, January 4, 2011 11:28 PM | 4 votes
Hi,
sorry I must have missed your reply ...
1. exclude DataSet designer from project
2. close Visual studio
3. remove Designer1.cs from disk
4. remove Designer.cs from disk (if it exists)
5. start Visual studio
6. open DataSet designer
7. now you should have Designer.cs
1. Since all the other files are dependent on xsd, you should exclude xsd and all will be excluded; in VS 2008 you can't even exclude anything but xsd, the option is not available for dependent nodes in solution explorer (haven't tried in VS 2010) ... so exclude myDataSet.xsd
3. myDataSet.Designer.cs is autogenerated file, which means that every time you modify your DataSet in designer that file is generated from scratch (that's why you should never manually modify its' content). DataSet Designer works primarily with xsd file, so even if you delete your generated Designer.cs files, once you reopen your project in VS, and include all of myDataSet files (xsd, xsc, xss - everything but Designer.cs file which was deleted) and reopen xsd file in designer, your mydataSet.Designer.cs file will be regenerated.
You can try the second solution too, might be easier to follow:
1. Close Visual Studio.
2. Use TortoiseSVN to rename the DataContext1.designer.cs file to DataContext.designer.cs, so the rename is picked up by source control.
3. Opened MyProject.csproj in Textpad. (just checkout csproj file first if it's not checkedout)
4. Performed search and replace for DataContext1.designer with DataContext.designer (found 2 instances).
5. Save and close.
You will need to do step 2 only if your myDataSet.designer1.cs file has already been added to source control. Otherwise, if it's still newly added file, skip step 2, just delete myDataSet.designer.cs file manually from disk.
Hope you'll find this helpful,
best regards,
Vladimir
Wednesday, January 5, 2011 7:40 AM
Hi Hamed_1983,
Have you tried the suggestion in Vladimir.Ilic's reply?
Has this question been solved?
If there's any concern, please feel free to let me know.
Have a nice day!
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Thursday, January 6, 2011 9:04 AM
Hi Hamed_1983,
Thanks for your response!
And I'm glad to hear that the question has been solved, although we also have not known the root cause. But maybe your operation is this question's correct solution.
Best wishes,
Mike [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Wednesday, December 5, 2012 10:07 AM
Thank you very much man.
Friday, June 17, 2016 1:46 PM | 1 vote
Make sure the following line exists in you .csproj-File:
<LastGenOutput>dataSet.Designer.cs</LastGenOutput>
You can find it in the following context:
<None Include="dataSet.xsd">
<SubType>Designer</SubType>
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>dataSet.Designer.cs</LastGenOutput>
</None>
This line tells the generator where it can find the last generator output. If it is missing the Generator trys to create a new Designer.cs-File with the same name. Since it already exists it creates a new one as follows: oldName + (oldNumber + 1) + .Designer.cs