最近,我必须开发一个 SharePoint 工作流程,老实说,我发现这是我曾经处理过的最痛苦的编程任务。 我遇到的一个大问题是当我必须在调试器中单步执行它时遇到的问题。
有一篇关于如何调试 SharePoint 工作流的文章 此处告诉您如何设置断点等。这涉及将 .pdb 文件与包含工作流程的 .dll 文件一起复制到 GAC 中。 您必须从命令提示符(或批处理文件)执行此操作,因为 Windows 资源管理器不允许您查看 c:\windows\ assembly 的相关子目录。
但是,如果您这样做,下次您尝试从 Visual Studio 中部署工作流时,它会抱怨无法部署,因为“文件可能未签名”,并且如果您尝试复制新版本的dll 进入 GAC,它会告诉您 .dll 文件已被锁定。
我发现有时,您可以通过执行 iisreset 来解决此问题,但在其他情况下,您必须重新启动 Visual Studio,并且经常出现我什至不得不完全重新启动计算机的情况,因为某些神秘的原因进程已锁定文件。 另一方面,当我不使用调试器时,一切都工作正常。
有谁知道比这更简单的调试工作流程的方法吗?
Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to step through it in the debugger.
There's an article on how to debug a SharePoint workflow here that tells you how to set breakpoints etc. This involves copying the .pdb file into the GAC alongside the .dll file containing your workflow. You have to do this from a command prompt (or a batch file) because Windows Explorer doesn't let you view the relevant subdirectory of c:\windows\assembly.
However, if you do this, the next time you try to deploy the workflow from within Visual Studio, it complains that it can't be deployed because "the file may not be signed" and if you attempt to copy the new version of the dll into the GAC, it tells you that the .dll file is locked.
I've found that some of the time, you can get round this by doing an iisreset, but on other occasions you have to restart Visual Studio and there have been frequent times when I've even had to reboot the computer altogether because some mystery process has locked the file. When I don't use the debugger, on the other hand, everything works just fine.
Does anyone know of a simpler way of debugging workflows than this?
发布评论
评论(6)
请查看 Ted Pattison、Andrew Connell、Scot Hillier 等 SharePoint MVP 在 CodePlex 上的 STSDev。
基思
Check out STSDev on CodePlex by SharePoint MVPs like Ted Pattison, Andrew Connell, Scot Hillier, and more.
Keith
我不确定您是否需要将 pdb 文件放入 GAC 中。 (至少,我要描述的修复对于在 VS2005 中调试 SharePoint Web 部件来说效果很好,VS2005 也有类似的问题。)
在“工具”-->“仅启用我的代码(仅托管)”中有一个标记为“仅启用我的代码(仅限托管)”的复选框。选项-->调试; 如果您取消选中它,则 Visual Studio 会很乐意从构建 pdb 的 bin\Debug 文件夹中加载您的 pdb。 大概。 无论如何,尝试一下也没什么坏处……
I'm not sure you need to get the pdb file into the GAC. (At least, the fix I'm about to describe works just fine for debugging SharePoint web parts in VS2005, which have a similar problem.)
There's a checkbox marked "Enable Just My Code (Managed Only)" in Tools-->Options-->Debugging; if you uncheck it, then Visual Studio will happily load your pdb's from the bin\Debug folder where it built them. Probably. Can't hurt to try, anyhow...
至于加快 IIS 重置速度,Andrew Connell 也提供了一些提示
http://www.andrewconnell.com/blog/archive/ 2006/08/21/3882.aspx
这使我的 IIS 重置时间从 10 多秒缩短到不到 2 秒。
As for speeding up the IIS reset, Andrew Connell has some tips here as well
http://www.andrewconnell.com/blog/archive/2006/08/21/3882.aspx
This brought my IIS reset time from 10+ seconds down to less than 2 seconds.
真正有帮助的一件事是,SharePoint 团队是否为运行 SP 工作流所需的 SP 特定工作流服务提供了接口。 这将允许您模拟这些接口并在 SP 之外运行工作流程。 AFAIK,你今天不能这样做。
我个人发现 SharePoint 的开发非常痛苦……不仅是工作流程,而且整体而言。 我了解管理方面的胜利和最终用户的生产力,但对于 Joe .NET 开发人员来说,这是一次相当可怕的体验。
One thing that would really help is if the SharePoint team provided interfaces for the SP-specific workflow services needed to run SP workflows. This would allow you to mock those interfaces and run the workflows outside of SP proper. AFAIK, you can't do that today.
I've personally found SharePoint extremely painful to develop against... not just with workflows, but overall. I understand the administrative wins and the end user productivity, but it's a fairly dreadful experience for Joe .NET Developer.
当我开始使用 WSPBuilder。 WSPBuilder 有一个名为 WSPBuilder Extensions 的 Visual Studio Addin,在我看来,WSPBuilder Extensions 比臭名昭著的 Windows SharePoint Services 3.0 工具:Visual Studio 2008 扩展,版本 1.2。 借助 WSPBuilder 菜单,只需单击一下即可部署/升级/卸载解决方案!
I've got a lot faster developing SharePoint-Solutions in general (not only Workflows) when i started using WSPBuilder. WSPBuilder has a Visual Studio Addin called WSPBuilder Extensions and in my opinion the WSPBuilder Extensions do a better job than the infamous Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2. Thanks to the WSPBuilder Menu deploy/upgrade/uninstall of a solution is just one click away!
SharePoint 团队目前正在开发 VS 2008 的 MOSS 扩展,它将允许此类功能。 这在带有 MOSS 扩展的 VS 2005 中可用,但必须在具有完整 MOSS 安装和正确权限集的 Windows Server 上运行。
The SharePoint team is currently working on MOSS extensions for VS 2008 which will allow this type of functionality. This was available in VS 2005 with MOSS extensions, but has to be run off Windows Server with a full MOSS installation and the correct permissions set.