3

I am publishing my website as precompiled deployment folder.

In my website, we have usercontrols.(ascx and ascx.cs)

While publishing using "rightclick on website and publish", we want to add ascx controls as it is in deployment folder without any change.

But cs file of usercontrol(test.ascx.cs)could be as dll in bin folder(precompiled) as appcode dll in bin folder.

We need ascx control as it is without precompiled format because we are loading usercontrol dynamically at runtime.

Is there anyway to publish so that "cs" usercontrols are compiled as dlls and usercontrols that are "ascx" are published as uncompiled source?

Andrii Kalytiiuk
  • 1,501
  • 14
  • 26
Bala
  • 27
  • 5
  • I don't think you can tell it to please precompile my site ..but, just not these files ! It's gonna be one or the other. Personally i gave up on the publish button a long time ago ..Araxis Merge all the way :-) – Robert Hoffmann Jul 10 '13 at 10:39
  • can you update the question with code how you loading usercontrol dynamically at runtime? – Damith Jul 10 '13 at 10:42
  • 1
    I don't see the connection between having the codebehind in a compiled dll and loading the ascx dynamically. One does not exclude the other. So with all due respect to the first answer, which is technically correct, I believe you're on a wrong train of thought here. – Alexander Jul 10 '13 at 11:26

1 Answers1

0

You can change the build action of the individual "ascx" files you do not want compiled. At the moment they will be set to "compile"

For any of the "ascx" files that you do not want compiled when you publish, perform the following steps.

  1. Right click the "ascx" file and click properties.
  2. In the properties window, change the Build Action property from "Compile" to "Content"

If you do this, the files you changed will not be compiled when you publish (or build for that matter). however they will be copied as content to the publish destination in their original file format.

dcarson
  • 2,853
  • 1
  • 25
  • 34
  • 1
    We are using website. We are not seeing properties on right click on the ascx in website usercontrol. How to set build action property from compile to Content in the case of website. It seems that you given the above idea for web application. – Bala Jul 11 '13 at 11:59
  • I can see them. What do you mean you are using "website"? Can you please clarify? – dcarson Jul 11 '13 at 12:36