发布 Web 应用程序时在 *.aspx、*.ascx 文件中搜索并替换

发布于 2024-08-28 18:08:09 字数 165 浏览 4 评论 0原文

当我发布 Web 应用程序时,我试图替换所有 .aspx 和 .ascx 文件中的模式。

当我在本地运行应用程序时,我不关心替换。但是,一旦我需要发布解决方案,我就需要一系列字符,比如说“ABC”,在我的所有 .aspx 和 .ascx 文件中用“DEF”替换。

我将如何执行此操作?

I'm attempting to replace a pattern in all my .aspx and .ascx file when I Publish my Webapplication.

When I am running the application locally, I don't care about the replace. But as soon as I need to Publish the solution I need a sequence of characters, let's say "ABC", replaced with "DEF" in all my .aspx and .ascx files.

How would I go about performing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

榆西 2024-09-04 18:08:09

您应该创建一个单独的脚本,它会遍历您的文件夹,搜索并加载所有 .aspx 和 .ascx 文件,打开它们并替换所有需要的内容。我不知道如何在 asp 中执行此操作,但在 actionscript 中它看起来像 fileText = fileText.replace(/ABC/g,"DEF");

You should create a separate script, that goes through your folder searching and loading all your .aspx and .ascx files, open them and replace all the needed stuff. I don't know how to do it in asp, but in actionscript it would look like fileText = fileText.replace(/ABC/g,"DEF");

我不在是我 2024-09-04 18:08:09

perl -p -i -e 's/ABC/EDF/g' *.aspx

perl -p -i -e 's/ABC/EDF/g' *.ascx代码>

perl -p -i -e 's/ABC/EDF/g' *.aspx

perl -p -i -e 's/ABC/EDF/g' *.ascx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文