I have a website project that I want to build using CruiseControl.net.
On one page there is a user control nested within a repeater control, and I need to get a strongly typed reference to that user control in the ItemDataBound event handler:
ASP.usercontrols_stars_ascx stars = (ASP.usercontrols_stars_ascx)e.Row.FindControl("stars");
stars.StarCount = Convert.ToInt32(drv["rating"]);
This works fine in VS2008 but breaks in MSBUILD with the following error:
w:\CCNet\InflatableBoats\Working\IBWeb\UserControls\DisplayReviews.ascx.cs (49,):
errorCS0234: The type or namespace name ‘usercontrols_stars_ascx’ does not exist in the namespace ‘ASP’ (are you missing an assembly reference?)
I think it might be a namespace problem because MSBUILD doesn’t seem to recognize the ASP namespace that the web site project uses for user controls and pages.
You should reference the codebehind class instead of the ascx generated class. The ascx class inherits your codebehind class. So define your StarCount property in codebehind, reference that, and you should be fine.