Not sure if anyone can help here, but we’re moving from VS 2008 to 2010 and have run into a compile issue on our website.
We converted the project which which returned 0 conversion errors.
When trying to build the website (not webapp project) an error appears in a generated .cs file in the asp.net temp folder stating local variable x is already defined. The error is right, the variable has been declared, but I can’t understand why the code generator would create 2 instances of the same control when there is only one.
#line default
#line hidden
namespace.to.control.lib controlid;
#line 9 "C:\path\control.ascx"
controlid = ((namespace.to.control.lib (@__container.FindControl("controlid")));
The above line is duplicated and the 2nd, is what the error points to.
I have cleared out the temp files for all .net versions installed – any other suggestions?
This is taken from the above note I added a while ago – I only thought it appropriate to add an ‘answer’ in the hope of helping anyone else who might come across this.
The control being duplicated in the .net temp files was nested inside another control via an ITemplate inner property.
This property was decorated with TemplateInstance.Single (loses the findcontrol pain and enables access the controls via id from the code behind).
The duplicated control had a bind which when removed seemed to stop the errors, but since the bind was needed the property attribute was removed and code re-factored to support it.