Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts


How to Regenerate Designer file in Visual Studio? Here is the solution-


Missing or corrupted designer file causes Visual studio (VS) to fail the build. This is because without designer file VS is unable to find the declarations of controls. Also most of the time 
controls are not added to designer.cs giving build errors.

To fix this issue, Below is the simplest solution I know:
  1. Delete your designer file if it is corrupted else start from step2.
  2. Go to your aspx markup (source) page and find below line of code.                                           <%@ Page Language="C#" AutoEventWireup="false" CodeFile="SamplePage.aspx.cs" Inherits=" SamplePageClass" %>
  3. Now change CodeFile tag to CodeBehind.
  4. Save the file.
  5. Rebuild your project (This will create designer file for your page)
  6. Revert your change (Step3).