How to regenerate aspx designer.cs file




















Chances are you have had this happen to you. In Web Application projects, the autogen code is stored in. Here is how you can regenerate them: First, make sure your class names, and page attributes are right.

Share this: Twitter Facebook. Like this: Like Loading Leave a Reply Cancel reply Enter your comment here Fill in your details below or click an icon to log in:. Some seem to be caused by Visual Studio bugs, others are caused by wrong usage or copy and pasting pages from outside your project.

Be as it may, often these issues are deceptively easy to solve! Your project must be a Web Application project. If you have a Web Site project, you do no need to worry about designer.

This is going to be a relatively short post. This is mostly because the original project was a Web Site, not a Web Project so that the. The project is quite large and has been mostly straightforward except for User Controls. The problem is that once we moved to compiled User Controls, there was a bunch of naming changes to be made. Part of this was because it was regenerating the Designer files for me. I thought I was smarter and did a bunch of renaming outside of Visual Studio. I ended up with lots and lots of errors because the.

Then open the designer or the aspx page and make one small change insert a space in the aspx and save it. Now the designer file should be recreated. Use Source Control in the future. Part from that, try copying the GUI controls into a new page and copy the content of its Designer page to your deleted one.

Having ReSharper installed helps with step 2 as it prompts to automatically register missing user controls but in my case, only after a restart. In my case, it was a user control that began missing it's designer file. So, in the ascx, I commented out all the content, leaving only the Assembly,Register, and Import headers. I then rebuilt the solution. With that success, I had new designer code auto generated. I removed the comments and rebuilt again.

Everything was back in the place it should be. Edit: It should be able to recreate it somehow. However my tip still stands: use source control.

Some time in the future, you will delete something vital and can't restore it via any means, and then you will be grateful for having source control. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Regenerate designer. Asked 10 years, 10 months ago.

Active 6 years, 3 months ago. Viewed 56k times.



0コメント

  • 1000 / 1000