views:

217

answers:

3

Is it possible to isolate an ascx controls in a separate project? I tried to create a project 'class library' and I can not add ascx component.

+2  A: 

Yes it is.

You can produce all stuff in the other project(web application), but when You are using ascx You have to make reference to Your ascx project and also You need to copy all ascx files into proper place in project where You want use it.

You can also use ClassLibrary, but then You need to create .ascx files and codebehind files manually and when using it You have to also copy ascx files into main project.

Rafal Ziolkowski
A: 

In other words - the answer is no

Lee Elenbaas
A: 

Yes, you can do this.

Create a website project. and deploy the release-build using Web-Deployment-Projects that will produce single assembly output for your website project.

Copy the ascx front-end files in your client asp.net project where you want to use consume the original library project and point the code-behind files to the classes in the assembly.

Web Deployment Projects provide the final step to create truly reusable user control assemblies. You can take the same Web site consisting exclusively of user controls and add a Web Deployment Project to create a single output assembly with the name of your choice. It's even straightforward to create a signed assembly to deploy to the GAC for sharing controls across multiple applications without redeploying the assembly in each /bin directory.

this. __curious_geek