Search code examples
c#asp.netdeploymentuser-controls

How to deploy a single user control which has changes to the cs file (ascx.cs)


I have a user control (UserControl1.ascx) and I made changes to its .cs file. That UserControl1.ascx is being used by two or more aspx files using LoadControl.

I don't want to deploy the whole web project DLL, as this is a fix for a critical issue in one part of the web app, and doesn't affect the whole web app.

Updating changes to the single web form code behind is easily done. However I'm not sure about the single user control deployment.


Solution

  • It's a bit of a hack, but you could move the code from the .ascx.cs file to the .ascx file and remove the inherits attribute. ASP.NET first checks the referenced class in the inherit attribute. So I think this should allow you to update the web application without updating the .dll files.

    I didn't test this, but I think it could be a viable option.