I am having a problem with visual studios premium 2012.
Recently, I changed the namespace of a button control, which inherits from Linkbutton. Code looks like this:
//namespace MyOldNameSpace
namespace MyNewNameSpace
{
public class myButton : LinkButton
{
//some stuff here
}
}
I updated my all references to this code to match this change. However…
The designer.cs files refuse to generate the buttons with the newly updated namespace. For instance, the functions look like this in my designer.cs files:
protected global::MyOldNameSpace.myButton myButton1
In order to make everything compile and work, I have to go into the code and update the Namespace in the designer.cs files. I am having no functionality issues. Also, I changed my web.config to match the new changes.
I have tried the following:
- Closing and re-opening visual studios
- Going into ~/../appdata/ and removing some files [found this solution on a blog]
But none of this has worked.
Thanks in advance
EDIT some changes that I made:
in web.config
<add tagPrefix="abc" namespace="MyNewNameSpace" assembly="MyNewNameSpace"
in the .aspx page
<abc:myButton runat="server" onclick=...etc...>
Your actions are:
What you expect is:
How it really works:
Updates to the designer.cs are triggered by changes in the .aspx file.
There are
23 possible scenarios to solve the problem:You have to Cut the control tag from the .aspx page => Save the .aspx page => Paste the control tag back inside the .aspx page => Save the .aspx page
or you manually modify the line by replacing the namespace:
[EDIT]
or you switch the .aspx from Source to Design => Save => Rebuild => Switch to Source
I’d say the option number three is the preferred workaround.