如何通过 Visual Studio 调试 Sharepoint 解决方案/功能?

发布于 2024-08-27 23:08:42 字数 180 浏览 3 评论 0原文

最近,我尝试通过 wspbuilder 实用程序将 Web 部件安装到 Sharepoint 站点。我已经创建、构建了一个项目并将其部署到 12 个配置单元。之后,通过中央管理站点安装解决方案并在网站集中激活。

我只是想知道如何调试复杂的功能/解决方案?由于两个进程(构建部署和激活)完全独立,因此如何将进程与工作进程附加在一起?

Recently I tried to install a webpart through wspbuilder utility to the Sharepoint Site. I have created, built and deployed a project to the 12 hive. After that installed the solution through Cental Administration Site and activated in the site collection.

I just wonder how can I debug the complex feature/solution ? Because both processes (build-deploy and activate) totally independent, how can I attach a process with the worker process ?

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

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

发布评论

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

评论(5

慕烟庭风 2024-09-03 23:08:42

在 WSPBuilder 上下文菜单中,有一个选项“附加到 IIS 工作进程”。只要应用程序已加载(通常意味着您在尝试附加之前已访问 SharePoint 站点中的页面)并且 SharePoint 中部署的代码与 Visual Studio 中的代码相同,您应该能够设置断点并单步执行代码。

In the WSPBuilder context menu there is an option "Attach to IIS worker process". As long as the app is loaded (generally means that you have accessed a page in the SharePoint site before trying to attach) and the code deployed in SharePoint is the same as the code you have in Visual Studio, you should be able to set breakpoints and step through the code.

尝蛊 2024-09-03 23:08:42

首先,您需要打开浏览器并导航到相关的 SharePoint 网站。然后,在 Visual Studio 中,转到“调试 -->”附加到进程,并找到与要调试的 Sharepoint 网站关联的 w3wp.exe 进程。单击它(进程),然后单击“附加”按钮。您现在应该能够调试与 SharePoint 功能相关的任何活动。

First, you need to open up your browser and navigate to the SharePoint website in question. Then, In Visual Studio, go to Debug --> Attach to Process, and find the w3wp.exe process associated with the Sharepoint website that you want to debug. Click it (the process) and then click the Attach button. You should now be able to debug any activities associated with your SharePoint feature.

糖果控 2024-09-03 23:08:42

有时,弄清楚要附加到哪个 w3wp 进程有点痛苦。尝试将以下内容添加到代码中以中断调试器:

System.Diagnostics.Debugger.Break();

Sometimes it is a bit of a pain to figure out which w3wp process to attach to. Try adding the following to your code to break into the debugger:

System.Diagnostics.Debugger.Break();

避讳 2024-09-03 23:08:42
System.Diagnostics.Debugger.Break()

正如 Muhimbi 所建议的,这在某些情况下实际上非常有用。假设您想要调试可能使用 stsadm 而不是浏览器调用的自定义代码(例如 feature_deactivating 事件)。 (例如,当功能隐藏在 UI 中时,您必须使用 stsadm 来停用功能)。使用 stsadm 时,您无法附加到 cmd.exe,因为这是一个单独的进程。如果您键入命令并按 Enter 键,然后找到要附加的 stsadm.exe 进程的 ID,则为时已晚。在这种情况下,上面的命令是最简单且最好的解决方案

System.Diagnostics.Debugger.Break()

Like Muhimbi suggested, this is actually very useful in certain cases. Say you want to debug custom code (e.g. feature_deactivating event) when it might be invoked with stsadm and not the browser. (for e.g. you will have to use stsadm for feature deactivation when feature is hidden in UI).When using stsadm you cannot attach to cmd.exe because that's a separate process. If you type the command and hit enter and then find its id of stsadm.exe process to attach to, its too late. In situations like these, the command above is the easist and best solution

安穩 2024-09-03 23:08:42

我尝试了这里提到的步骤

转到调试-->附加到进程,并找到与要调试的 Sharepoint 网站关联的 w3wp.exe 进程

但我得到“不会命中断点,当前尚未为此文档加载任何符号”。我是否必须使用 GACUTIL 注册自定义部署的解决方案 dll?我是否必须将 PDB 文件复制到任何特定位置?
我在这里缺少什么?

I tried the steps as mentioned here

go to Debug --> Attach to Process, and find the w3wp.exe process associated with the Sharepoint website that you want to debug

But I get "Breakpoints will not be hit, no symbols have currently been loaded for this document". Should I have to register the custom deployed solution dll using GACUTIL ? Should I have to copy the PDB files at any particular location ?
What am I missing here ?

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