在没有sharepoint环境的中开发sharepoint程序
经常sharepoint开发同行说,只有在安装sharepoint的环境中才能开发sharepoint应用吗?其实不然,这篇文章就是讲解如何解决这个问题的。
One of my biggest pet peeves when doing SharePoint development is the "requirement" that you work on a machine with SharePoint installed. On some levels this makes sense -- you will actually need a SharePoint environment to test whatever code you write. On the other hand, a development server that runs SharePoint and all of the pieces it needs (e.g. SQL server) requires a lot of resources. Usually you end up with a sluggish, unresponsive machine to develop on which affects a SharePoint developer's productivity.
So what? Just code on another machine and deploy to a SharePoint environment, right? If you've ever tried that with Visual Studio 2010, you've probably seen this error trying to create a project... "A SharePoint server is not installed on this computer. A SharePoint server must be installed to work with SharePoint projects."

Fortunately there is a simple trick to get around the error and start building SharePoint projects off of the server. It involves modifying the registry -- be careful!
1) Log on to a working SharePoint server (2010 in this case) and fire up Registry Editor.
2) Locate this key: HKLM/Software/Microsoft/Shared Tools/Web Server Extensions.
3) Right-click and select Export.
4) Save the file (it will have a .reg extension) and move it over to the machine without SharePoint installed.
5) Double-click the .reg file to import the settings in the registry.
So far, so good. Now if you actually want to *build* your code, you'll have to take a couple more steps.
6) Zip up the relevant DLLs from your sharepoint server and copy to the development machine. Be careful that this doesn't violate your license.
7) Using GACUtil, install the DLLs into the GAC.
7.5) (if working with an existing project) Add the necessary references to your project (Microsoft.SharePoint, perhaps more).
8) Re-open Visual Studio, and try again to create an "Empty SharePoint Project".
Voila! It should work without a hitch.
There are a few limitations when developing in this setup. Not all of the SharePoint-related functionality will work -- for example, adding a Content Type to your project will result in an error. This is because it uses Visual Studio's "SharePoint Connections" which cannot be accessed from off-server.
Another thing that won't work is the right-click > Deploy menu option. You'll have to write your own script to deploy remotely or manually copy the WSP and install it.
One of my biggest pet peeves when doing SharePoint development is the "requirement" that you work on a machine with SharePoint installed. On some levels this makes sense -- you will actually need a SharePoint environment to test whatever code you write. On the other hand, a development server that runs SharePoint and all of the pieces it needs (e.g. SQL server) requires a lot of resources. Usually you end up with a sluggish, unresponsive machine to develop on which affects a SharePoint developer's productivity.
So what? Just code on another machine and deploy to a SharePoint environment, right? If you've ever tried that with Visual Studio 2010, you've probably seen this error trying to create a project... "A SharePoint server is not installed on this computer. A SharePoint server must be installed to work with SharePoint projects."

Fortunately there is a simple trick to get around the error and start building SharePoint projects off of the server. It involves modifying the registry -- be careful!
1) Log on to a working SharePoint server (2010 in this case) and fire up Registry Editor.
2) Locate this key: HKLM/Software/Microsoft/Shared Tools/Web Server Extensions.
3) Right-click and select Export.
4) Save the file (it will have a .reg extension) and move it over to the machine without SharePoint installed.
5) Double-click the .reg file to import the settings in the registry.
So far, so good. Now if you actually want to *build* your code, you'll have to take a couple more steps.
6) Zip up the relevant DLLs from your sharepoint server and copy to the development machine. Be careful that this doesn't violate your license.
7) Using GACUtil, install the DLLs into the GAC.
7.5) (if working with an existing project) Add the necessary references to your project (Microsoft.SharePoint, perhaps more).
8) Re-open Visual Studio, and try again to create an "Empty SharePoint Project".
Voila! It should work without a hitch.
There are a few limitations when developing in this setup. Not all of the SharePoint-related functionality will work -- for example, adding a Content Type to your project will result in an error. This is because it uses Visual Studio's "SharePoint Connections" which cannot be accessed from off-server.
Another thing that won't work is the right-click > Deploy menu option. You'll have to write your own script to deploy remotely or manually copy the WSP and install it.
欢迎沟通及共同进步
QQ:1441299
Email:1441299@qq.com
越折腾越快乐!
分类:
sharepoint
标签:
没有安装sharepoint环境
, sharepoint开发
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端