跨项目分布 ASP.NET 用户控件的技术

Techniques For Distributing ASP.NET User Controls Across Projects(跨项目分布 ASP.NET 用户控件的技术)
本文介绍了跨项目分布 ASP.NET 用户控件的技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您想要创建可供不同项目使用的控件库时,跨不同项目分布 ASP.NET 用户控件非常有用.

Distributing ASP.NET user controls across different projects can be really useful when you want to create a library of controls that can be used by different projects.

不幸的是,据我所知,ASP.NET(至少 2.0)并不能很好地支持这一点.

Unfortunately, to my knowledge, ASP.NET (2.0 at least) doesn't support this very cleanly.

我知道的唯一技术是将控件添加到另一个项目,然后将 ascx(并且只有 ascx,除非您当然要扩展控件)文件复制到引用该控件的项目中,然后删除来自它的 CodeBehind 参考.

The only technique I know of is to add the control to another project, then copy the ascx (and only the ascx, unless you want to extend the control of course) file into the project that references the control, and remove the CodeBehind reference from it.

它有效,但感觉很hackish.

It works, but it feels hackish.

有谁知道跨项目拆分控件的更好方法?(也许 3.5 有帮助?)

Does anyone know of a better way to split controls across projects? (perhaps 3.5 helps somehow?)

推荐答案

您可以查看 Scott Guthrie 的这篇文章:

You could check out this article by Scott Guthrie:

构建可重用的 ASP.NET 用户控件和页面带有 VS 2005 的库

这篇关于跨项目分布 ASP.NET 用户控件的技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)