0

I made updates to an ascx file that include new server controls in the user control and Visual Studio 2010's original attempt to update the designer file failed because the file was set to readonly due to an unfortunate choice of source control.

I've made the file editable, but can't seem to figure out how to retrigger the update. I've even removed my original ascx changes, hit save, then put them back in, saving yet again. How can I trigger VS2010's update of the designer.cs file?

Michael Lang
  • 2,157
  • 3
  • 22
  • 29
  • 1
    Did you rebuild the solution? – Oded May 13 '11 at 20:32
  • @Oded - First rebuild failed to update the designer.cs file. It failed with errors because I have code in my code-behind that depends on the properties that are supposed to get added to the designer file. I'll try removing those to see if a successful rebuild will do it. – Michael Lang May 13 '11 at 20:37
  • Successful rebuild failed to do it too. I ended up adding a literal control with an ID of "JustGetMyFileToUpdate" and then removed it as a workaround. Surely there's a better way. Somehow if I remove and add the original controls that failed, they continue to fail as if Visual Studio holds onto a cache of things that it adds to the designer file and refuses to do it again even when the first attempt failed. – Michael Lang May 13 '11 at 20:46
  • 1
    http://stackoverflow.com/questions/520593/how-do-you-clear-your-visual-studio-cache-on-windows-vista – Oded May 13 '11 at 20:47
  • one of the answers for this thread may help [how do you force visual studio to regenerate the designer files for aspx-ascx](http://stackoverflow.com/questions/45325/how-do-you-force-visual-studio-to-regenerate-the-designer-files-for-aspx-ascx-fi) – Roger Stewart May 13 '11 at 20:49
  • @Oded - thanks. I found a workaround. I'll have to try clearing the cache another time. That I can't trigger the update regardless of what's cached through the IDE feels like WTF to me. Can hardly believe there's still no feature for it – Michael Lang May 13 '11 at 20:51
  • @Roger - I tried searching, but somehow didn't find that question. Thanks. Switching back and forth between design/markup modes didn't work for me. Maybe VS2010 is different? – Michael Lang May 13 '11 at 20:52

2 Answers2

1

Surely there's a better way, but as a workaround, I added and removed a literal control:

<asp:Literal ID="JustMakeTheFileUpdate" runat="server"></asp:Literal>

That worked, but somehow removing and re-adding the controls that failed the first time doesn't work.

Michael Lang
  • 2,157
  • 3
  • 22
  • 29
0

Adding the literal control worked for me - was tearing my hair out with this! Just to confirm, I emptied the class definition in the existing designer file (so it was just an empty class) and then went back to the markup and pasted in the literal control in the answer. That caused a regneration (at last!).

Rory Solley
  • 1,435
  • 1
  • 9
  • 6