如何从BuildProvider迁移到Web应用程序项目?

发布于 2024-09-13 17:36:08 字数 394 浏览 5 评论 0原文

目前我们有很多网站(网站项目),我认为应该将它们转换为 Web 应用程序项目。大家都同意。

但许多自定义 BuildProvider 用于生成控件,不幸的是 MSDN 说

将自定义的 BuildProvider 类添加到 Web.config 文件在 ASP.NET 网站中有效,但在 ASP.NET Web 应用程序项目中不起作用

是否有一些方法可以在不完全放弃自定义 BuildProviders 机制的情况下进行迁移?

Currently we have a bunch of web sites (web site projects) that I think should be converted to web application projects. Everybody agrees.

But a number of custom BuildProviders are used to generate controls and unfortunately MSDN says that

Adding a customized BuildProvider class to the Web.config file works in an ASP.NET Web site but does not work in an ASP.NET Web application project

Are there some ways to migrate though without full discarding of custom BuildProviders mechanism?

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

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

发布评论

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

评论(3

再见回来 2024-09-20 17:36:08

在不确切知道您的构建提供商做什么的情况下,我可以看到两种可能的解决方案:

  1. 自定义 MSBuild 任务
  2. T4 模板

Without knowing exactly what your build provider do I can see two possible solutions:

  1. Custom MSBuild tasks
  2. T4 templates
纵山崖 2024-09-20 17:36:08

嘿,您需要实现一个自定义 IVsSingleFileGenerator。
并将其注册到您的 VS,以生成自定义的 .designer 文件。
DesignTime-Compilation 的工作方式随着 Web 应用程序项目而改变。

与 BuildProvider 结合使用,您将获得与 ASPX-Pages 相同的效果。

我用它来生成带有部分方法的用户界面,以在代码隐藏文件中实现行为。

Hey you need to implement, a custom IVsSingleFileGenerator.
And register it with your VS, to generate a custom .designer-File.
The way DesignTime-Compilation works changed with Web Application Projects.

In combination with a BuildProvider you will get the same as ASPX-Pages.

I used it to generate user-interfaces with partial-methods to implement behavior in a codebehind-file.

墨小沫ゞ 2024-09-20 17:36:08

如果不审查整个方法,这是不可能的。

That's impossible without review of the whole approach.

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