Tuesday, 16 December 2014

SharePoint 2013 Visual webpart ".ascx.g.cs" file is not updating.

I created a SharePoint 2013 visual webpart using VS2013 and I did some modification in the namespace and class name for naming convention.  After this my ".ascx.g.cs" is not updating.  Then I cant add new controls in the webpart.

I found the reason is below entries are missing in the .proj file.  After adding the below entries everything working fine.

Entry 1

Before:
    <Compile Include="Webparts\testWebPart\testWebPart.ascx.g.cs" />

After :
    <Compile Include="Webparts\testWebPart\testWebPart.ascx.g.cs" >
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DependentUpon>test.ascx</DependentUpon>
    </Compile>

Entry 2

Before: 
  <Content Include="Webparts\SiteMapWebpart\test.ascx/>

After

      <Content Include="Webparts\SiteMapWebpart\test.ascx">
      <Generator>SharePointWebPartCodeGenerator</Generator>
      <LastGenOutput>test.ascx.g.cs</LastGenOutput>
    </Content>

Happy Coding :) - Sugu
 

No comments:

Post a Comment