简体   繁体   中英

Publishing of User control in asp.net website

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM