Reputation: 31
I have a standard web site project and a web deployment project in VS2010. I've been using this project and deployment package for about 4 years now without problems.
The Deployment package has been set to 'Merge all pages and control outputs to a single assembly'.
Not had a problem with this set-up for 3-4 years, until now! In the newest version of the web site I've added a folder with some pages and another folder with 3 user controls in. Now when I build the deployment package 2 of the 3 user controls compile into their own dll's, the rest compile as expected. I've checked the namespace in the code behind pages of all three controls and they are all the same and can't find anywhere where it would be telling the compiler to compile these two controls and not the others?
My control is in Namespace G2F.Forms.Controls.FormDefintitionListItemControl (which reflects the folder structure and control name).
I have a page that needs to get a reference to one of these controls and uses:
.FindControl("IdName") as MyControl
The code all works fine when using the web site or running the project but when you compile the web site the code above returns null, because the control is now of type ASP.forms_controls_formdefinitionlistitemcontrol_ascx.
This and one other control are the only ones compiling in this way and there are about 40-50 other controls in the solution.
Upvotes: 1
Views: 1654
Reputation: 31
As per my last comment I found a solution by converting the web site to a web application, there are loads of gotcha's when doing this but eventually after lots of sorting namespaces and a fair few compiles to get the deployment settings right (set the "Allow this precomiled site to be update" checked!) I got it working.
It seems a bit extreme but having lost 4 days chasing the error and rebuilding it's nice to be able to get it working again!
Upvotes: 2