是否可以使用 Visual Studio/C# 进行 SharePoint 2007 开发而不将 DLL 部署到 Hive
如果客户不允许将 .dll 安装到其 SharePoint 2007 配置单元(或 GAC)中,是否有任何方法可以使用 Visual Studio 创建 Web 部件等,而无需将 .dll 部署到配置单元中(或 GAC)?如果没有,是否有另一种方法可以以类似的方式将 Visual Studio 和/或 C# 与 SharePoint 命名空间功能结合使用,即使不完全按照标准方式?该客户不允许我们在页面上安装任何内容,如果不安装到 GAC 或配置单元中,也不允许我们安装由我们开发的与 SharePoint 相关的 .dll。
注:文章末尾有一些具体的项目细节。
已接受答案的最终摘要:
- 没有提供部署自定义 SharePoint 程序集的替代方法(例如,不是 GAC 也不是 hive)的答案。
- 但是,可以使用嵌入到页面中的 C#,并且您可以引用 SharePoint 程序集并在代码中使用它。 (有关详细信息,请参阅已接受的答案)
- 我期望的许多事情似乎不需要自定义代码,而且在许多情况下似乎这样做甚至是可能/有益的。
我对它如何工作有一些基本想法(“奇迹发生”),但是,现在坚定地处于“不知道我不知道什么”象限,我不知道它是否可以做到,而且我不知道除了直接在 SharePoint Designer 中直接开发而无需 C#/Visual Studio 之外,是否有任何可能的替代途径可以获得任何好处。
想法:
像平常一样使用 Visual Studio 进行开发,使用 WSPBuilder 或库存 SharePoint 项目,但不是正常部署,而是将 .dll 安装在计算机上的非配置单元位置,然后以某种方式将项目包含为外部资源。
创建一个自托管 Web 服务,以某种方式可以称为可合并到 SharePoint 网站的服务组件。
在非 SharePoint Web 项目中开发单独的网页/Web 控件,然后以某种方式将它们包含到 SharePoint 网站中;或者,以某种方式在 IIS 目录中创建对它们的引用
在 Web 应用程序中开发单独的网页/Web 控件,并使用 Hostable WebCore 来提供所需的内容,当然,还要以某种方式将提供的页面包含到 SharePoint 中。
而且,我最后担心的是,即使我弄清楚了“神奇发生”步骤的详细信息,我仍然无法得到我想要的,即能够以有用的方式使用 SharePoint 命名空间的功能,例如连接到我们正在开发的站点,并且有足够的访问权限来执行我们需要的操作,而无需跳过太多的麻烦,无论是从开发人员的角度(例如难以使用或维护的代码),还是糟糕的用户体验(例如用户反复收到登录提示)。
(如果答案很明显,我很抱歉;我对 SharePoint 开发是全新的,并且我只具有高级 Web 开发经验(例如相当简单的 .ascx/.aspx,并且主要使用页面设计器),所以当我搜索“明显”搜索词的帮助时,我必须快速掌握方向,我得到了大量有关正常情况的信息,但尚未找到答案。)
根据要求,以下是我可以提供有关特定情况的详细信息 项目。我目前只掌握其中一部分的信息,这是一个长期项目,有很多部分将相互构建。因此,不幸的是,如果解决方案不是相当通用,我可能必须采用 SharePoint Designer 路线,以避免依赖可能与将来出现的部分不兼容的方法相关的风险。另外,对于这些内容的通用性,我深表歉意;我试图提供所需功能的列表,而不是详细说明实际项目。
- 能够拥有单独的用户站点主页,允许他们查看有关他们拥有的项目和他们参与的项目的各种信息
- 能够拥有存储用户要遵循的向导类型步骤的站点模板
- 链接向导模板的能力与各个步骤相关的各种文档和可能的其他内容
- 能够存储各种相关角色和属性(例如完成任务需要多长时间) 以及模板中的项目
- 用户能够使用向导来创建站点项目的实例并允许或强制基于其他用户的分配模板属性
- 与项目关联的某些角色能够编辑文档并将其保存回来,并限制其他人对其进行编辑
- 项目创建者以外的用户的能力(可能基于用户分配的项目角色)查看项目中的所有信息(时间表等)并编辑项目中的所有文档
- 已分配角色的关联用户的能力 在完成其任务部分时进行标记
- 能够根据属性中的信息计算时间表项目中的不同项目
- 通知用户的能力(通过电子邮件和网站)主页通知)在必须采取行动或被标记为需要接收一个或多个项目项更新的角色中,
- 一旦完成某一步骤,就能够锁定项目项以防止修改;并可能解锁和/或收回步骤
- 自动创建报告并将其发送到适当位置(可能是电子邮件,也可能是站点上的管理页面,或完全发送到另一个站点。)的
- 能力 标记已完成的项目和存档的能力它们在一个单独的部分中,只能由某些窗口组或现场定义的组查看。
我也知道,一旦我们完成了第一部分,使客户满意,就会大大增加该项目的范围。我正在尝试查找更多信息,如果可用,我会在此处发布。
我意识到其中的一些内容可能确实与 SharePoint 无关,而且其中一些内容可能无法真正提供足够的信息来告诉您它将需要哪些功能或其他功能。我很乐意澄清任何没有意义的事情,但我想尝试提供一些细节,因为其他人可能比我更了解哪些 SharePoint 部分是必要的或可能使用的。
If a customer does not allow installation of a .dll into their SharePoint 2007 hive (or the GAC), is there any way to create webparts, etc. with Visual Studio that will not require deployment of the .dll(s) into the hive (or the GAC)? If not, is there another way to use Visual Studio and/or C# with the SharePoint namespace functionality in a similar fashion even if not quite in the standard way? This customer isn't going to allow us to install anything on the box beyond the pages and, if not into the GAC or hive, SharePoint-related .dlls developed by us.
Note: there are some specific project details at the end of the post.
Final Summary of Accepted Answer:
- No answer was forthcoming with an alternative method of deploying custom SharePoint assemblies (e.g. not GAC and not hive).
- It is possible, however, to use C# embedded in a page, and you may reference the SharePoint assembly and use it in the code. (see accepted answer for details)
- Many of the things that I had expected would need custom code do not seem to, nor does it seem that in many cases it would even be possible/beneficial to do so.
I have a few basic ideas on how it might work ("magic happens"), but, being firmly in the "don't know what I don't know" quadrant right now, I don't know if it can be done, and I don't know whether any possible alternative route would even gain anything beyond just developing directly in SharePoint Designer sans C#/Visual Studio altogether.
ideas:
Develop with Visual Studio as normal, using WSPBuilder or a stock SharePoint project, but instead of normal deployment, installing the .dll(s) in a non-hive location on the machine, and then somehow including the items as an external resource.
Create a self-hosting web service that somehow can be called serve up components that can be incorporated into the SharePoint site.
Develop separate web pages/web controls in a non-SharePoint web project, then including them somehow into the SharePoint site; or, somehow creating a reference to them in the IIS directories
Develop seperate web pages/web controls in a WebApplication and using the Hostable WebCore to deliver what is needed, and, of course, somehow including the served up pages into SharePoint.
And, my final concern is that even should I figure out the details on the "magic happens" steps, I still would really not have gotten what I want, which is to be able to use the functionality of the SharePoint namespace in a useful way, e.g. connected to the site we are developing, and with sufficient access to do what we need without jumping through too many hoops, either from a developer perspective (e.g. code that's hard to use or maintain), or a bad user experience (e.g. user repeatedly getting login prompts).
(My apologies if the answer is obvious; I'm brand new to SharePoint development, and I'm only experienced with high-level Web development (e.g. fairly simple .ascx/.aspx, and mostly using the designer for pages), so I'm having to get my bearings quickly. When I search for help with the 'obvious' search terms, I get an overwhelming amount of information for normal scenarios, but have not found an answer for this.)
Upon request, here are the details that I can give about the particular project. I currently have information on only a piece of it, and it's a long-term project with a lot of pieces that will build on one another. So, unfortunately, if the solution isn't fairly generic, I will probably have to go the SharePoint Designer route to avoid the risk associated with relying on a method which may not be compatible with pieces that come down the road. Also, I apologize for how generic these are; I am trying to provide a list of capabilities needed as opposed to detailing the actual project.
- ability to have individual user site home-pages that allow them to view various bits of information about projects they own and projects they are involved in
- ability to have site templates that store wizard-type steps to be followed by users
- ability to link the wizard templates to various documents and possibly other things associated with the various steps
- ability to store various associated roles and attributes (such as how much time is allowed for a task to be completed) with the items in the templates
- ability for a user to use the wizard to create instances of the site items and allow or enforce the assignment of other users based on the template attributes
- ability for some roles associated with an item to edit the document and save it back, and to restrict others from editing them
- ability for users other than the creator of the project (probably based on a project role assigned by the user) to view all info (timelines, etc.) and edit all documents in the project
- ability for the associated users that have roles assigned to mark off when they are complete with their portion of the task
- ability to calculate timelines based on info from the attributes for the different items in the project
- ability to notify users (via email and site homepage notifications) in roles that have to take action or are marked as needing to received updates on one or more project items
- ability to lock down project items from modification once a step has been completed; and possibly to unlock and/or retract steps
- ability to automatically create reports and send them to appropriate locations (probably e-mail, but also possibly an administration page on the site, or to another site entirely.)
- ability to mark completed projects and archive them in a separate section only viewable by certain windows groups or groups defined on-site
I also know that there is an intent to greatly increase the scope of this project once we complete the first part to the customer's customer's satisfaction. I am trying to find out more information and will post here if/when that is available.
I realize that some of what's there might really have nothing to do with SharePoint in particular, and some of it may not really give enough information to tell you which feature or other it will need. I am happy to clarify anything that doesn't make sense, but I wanted to try to give a little detail as someone else may have a lot better idea of what SharePoint pieces would be necessary or possible to use than I.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一点,您应该看看是否可以从 sharepoint 2007 升级到 2010,因为您所描述的许多问题在 2010 年都变得更容易解决。
如果您能做到这 真正帮助我制定更彻底的答案的是对您试图实现的功能的非常简短的描述。
好的,感谢您的更新。
我将尽力解决该项目的所有要点。
这些在 SP 2007 中都可用,但说实话,就项目的难度和长度而言,使用 SP 2010 在经济上会更负责。而且,过渡过程很顺利,你实际上不会失去任何东西,只是获得。从你所说的来看,这可能是不可能的,这很遗憾,但无论如何,祝你好运!
这部分应该可以帮助您处理 C# 页面,这是一个基本的 hello world 页面。
我通常在共享点设计器中对此进行编码。另外,如果您需要使用服务器上提供的
Microsoft.SharePoint.dll
,您可以添加以下行:<%@ Import Namespace="Microsoft.Sharepoint" %> ;
,由于它是服务器上的页面,因此您不需要以任何方式专门链接它,只需在页面语言声明之后的一小行即可。希望这能澄清一切!If you can at all wing it, you should see if it would be possible for an upgrade from sharepoint 2007 to 2010 to be made, because many of the problems you are describing are made a whole lot easier to solve in 2010.
Something that would really help me develop a more thorough answer is a very brief description of what functionality you are attempting to achieve.
OK, Thanks for the update.
I will try my best to address all the points of the project.
These are all available in SP 2007, but honestly, it would be financially more responsible as far as the difficulty and length of the project to use SP 2010. Also, the transition process is smooth and you don't really lose anything, just gain. From what you've said though, this might not be possible, which is a shame, but good luck either way!
This part should help you out with the C# pages, here is a basic hello world page.
I normally code this in sharepoint designer. Also, say if you need to work with
Microsoft.SharePoint.dll
, provided on the server, you could add this line:<%@ Import Namespace="Microsoft.Sharepoint" %>
, since it is a page on the server, you don't need to specifically link it in any way, just that one little line after the page language declaration. Hope this clears everything up!一种选择是将代码部署到 BIN 目录而不是 GAC 目录。
BIN 目录以最少的速度运行信任。但是,有些东西不能部署在这里(例如事件接收器)。
另请参阅如何部署 SharePoint Web部分到垃圾箱。
An option would be to deploy code to the BIN directory instead of the GAC.
The BIN directory runs with minimal trust. However, some things can't be deployed here (like event receivers).
See also, How to deploy a SharePoint web part to bin.
我们有一个采用 IronPython 脚本的解决方案。有一个 IronPython Web 控制台、通用 IronPython 事件接收器、页面、工作流程、计时器作业、也可以通过 Web 界面进行编辑的脚本库以及包含必要配置的列表。我希望在某个时候开源它的核心,但完整版本可以做更多的事情。
关键是我们不需要为每个特定客户需要添加或更改的每一个小事情进行重新部署。特别是对于工作流程 - 我们可以进行微小的更改,而不会破坏当前正在运行的所有内容。
We have a solution which employs IronPython scripts. There's a IronPython web console, generic IronPython event receiver, page, workflow, timerjob, library of scripts which can also be edited through web interface, and a list with necessary configurations. I'm hoping to opensource the core of it at some point, but the full version can do a lot more.
The point is we don't need to do redeploys for every single little thing that needs to be added or changed for each particular customer. Particularly with workflows - we can do small changes without breaking everything that's currently running.