Issue: Sometimes it happens that designer (.ascx.g.cs) file is missing after saving the changes in Visual web part .ascx file and designer (.ascx.g.cs) file is not re-generating automatically.
Solution: Check and perform all the below steps:
Solution: Check and perform all the below steps:
1. First check whether the project properties in which visual web part exists is having correct SharePoint Site URL and connected to server or not.
If it is connected, then it would look like below.
2. Then check .ascx page properties, it should have SharePointWebPartCodeGenerator value for Custom Tool
3 If designer (.ascx.g.cs) file exists but if you made some changes in the HTML but its changes are not reflected in designer (.ascx.g.cs) file, then it might be the case of below.
To fix the problem you need to open up and edit the project .csproj file. Simply open the file and search for your web part, in my case I’m looking for the “SiteDescriptionWebPart” web part.
Once, you’ve identified the web part elements, you’ll need to check below code and do the changes as per required.
<Compile Include="SiteDescriptionWebPart\SiteDescriptionWebPart.ascx.cs">
<DependentUpon>SiteDescriptionWebPart.ascx</DependentUpon>
</Compile>
<Compile Include="SiteDescriptionWebPart\SiteDescriptionWebPart.ascx.g.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SiteDescriptionWebPart.ascx</DependentUpon>
</Compile>
This all above steps will solve your designer (ascx.g.cs) file issues and it will re-generate the new designer file after saving any changes in the .ascx file.
thanks a lot this really helped me
ReplyDelete