简体   繁体   English

在asp.net网站上发布用户控件

[英]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) 在我的网站上,我们有usercontrols。(ascx和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. 使用“右键单击网站并发布”进行发布时,我们希望在部署文件夹中添加ascx控件,而不进行任何更改。

But cs file of usercontrol(test.ascx.cs)could be as dll in bin folder(precompiled) as appcode dll in bin folder. 但是usercontrol(test.ascx.cs)的cs文件可以作为bin文件夹(预编译)中的dll作为bin文件夹中的appcode dll。

We need ascx control as it is without precompiled format because we are loading usercontrol dynamically at runtime. 我们需要ascx控件,因为它没有预编译格式,因为我们在运行时动态加载usercontrol。

Is there anyway to publish so that "cs" usercontrols are compiled as dlls and usercontrols that are "ascx" are published as uncompiled source? 无论如何要发布,以便“cs”用户控件被编译为dll,而“ascx”的用户控件是作为未编译的源发布的?

You can change the build action of the individual "ascx" files you do not want compiled. 您可以更改不希望编译的各个“ascx”文件的构建操作。 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. 对于您在发布时不希望编译的任何“ascx”文件,请执行以下步骤。

  1. Right click the "ascx" file and click properties . 右键单击“ascx”文件,然后单击属性
  2. In the properties window, change the Build Action property from "Compile" to "Content" 在属性窗口中,将Build Action属性从“Compile”更改为“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. 但是,它们将以原始文件格式作为内容复制到发布目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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