visual-studio 使用 Visual Studio 2010 Express 构建 webpart

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2848397/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:59:38  来源:igfitidea点击:

Building webparts with Visual Studio 2010 Express

visual-studiosharepointvisual-studio-2010web-parts

提问by MalphasWats

I'm trying to get started with building my own webparts, planning to follow this MSDN article.

我正在尝试开始构建我自己的 webparts,计划关注这篇MSDN 文章

I've downloaded Visual C# 2010 Express - I'm not quite at the point where I feel comfortable dropping 1000 big ones yet, and I installed Visual Web Developer 2010 Express via the WPInstaller.

我已经下载了 Visual C# 2010 Express - 我还不太愿意放弃 1000 个大的,我通过 WPInstaller 安装了 Visual Web Developer 2010 Express。

Following through the tutorial, aside from the fact that I don't get the option to create a "Web Control Library", a gap I filled with this article, I can't seem to find the sn.exe tool (or the "Visual Studio 2005 Command Prompt"!).

按照教程进行操作,除了我没有选择创建“Web 控件库”这一我在本文中填补的空白之外,我似乎找不到 sn.exe 工具(或“ Visual Studio 2005 命令提示符”!)。

I know it's not quite a direct programming related question, but I can't even get the thing going yet!

我知道这不是一个直接与编程相关的问题,但我什至无法解决问题!

Any help is appreciated. Thanks

任何帮助表示赞赏。谢谢

EDIT:-

编辑:-

I think I may be jumping the gun quite considerably, I wrote a simple hello world example and tried to build it but it doesn't have any references to the Microsoft.SharePointpackages and they don't appear in my lists.

我想我可能相当大了,我写了一个简单的 hello world 示例并尝试构建它,但它没有对Microsoft.SharePoint包的任何引用,它们也没有出现在我的列表中。

Am I understanding some more research I've done (namely this) correctly, in that I have to actually have a full installation of actual SharePoint on the machine I'm developing on?

我是否正确地理解了一些我已经完成的研究(即这个),因为我必须在我正在开发的机器上完全安装实际的 SharePoint 吗?

采纳答案by Ryan

sn.exeis part of the .Net Framework SDK tools - not actually part of Visual Studio.

sn.exe是 .Net Framework SDK 工具的一部分 - 实际上不是 Visual Studio 的一部分。

If you've got the SDK installed (which I think you must have if you're using VS) then it will be in a directory such as (depending on which version of .NET SDK you've got installed)

如果您已经安装了 SDK(如果您使用 VS,我认为您必须安装),那么它将位于一个目录中,例如(取决于您安装的 .NET SDK 版本)

c:\program files\microsoft.net\SDK\v2.0\Bin

c:\program files\microsoft.net\SDK\v2.0\Bin

You can develop SharePoint web parts with VS express but you won't be able to use extensions like VSeWSSwhich can make your life a little easier.

您可以使用 VS express 开发 SharePoint Web 部件,但您将无法使用像VSeWSS这样的扩展程序 ,它可以让您的生活更轻松一些。

You don't have develop on a machine with SharePoint installed upon - you can just copy the Microsoft.SharePoint.dll assembly from a machine with it installed on and reference it in your project.

您没有在安装了 SharePoint 的机器上进行开发 - 您只需从安装了 Microsoft.SharePoint.dll 的机器上复制 Microsoft.SharePoint.dll 程序集并在您的项目中引用它。

There are pros and cons to developing on a SharePoint machine.

在 SharePoint 机器上进行开发有利有弊。

  • Its easier to get started - especially debugging locally rather than remote debugging.
  • Harder to be sure that you're code will work a 'real server' - are you sure you don't have any dependencies that may not be installed.
  • Harder to work with multiple versions of SharePoint (2007 WSS and MOSS and 2010 foundation, server etc).
  • 它更容易上手——尤其是本地调试而不是远程调试。
  • 更难确保您的代码可以在“真实服务器”上运行 - 您是否确定没有任何可能未安装的依赖项。
  • 更难使用多个版本的 SharePoint(2007 WSS 和 MOSS 以及 2010 基础、服务器等)。

If you do want to work with a locally installed SharePoint then

如果您确实想使用本地安装的 SharePoint,那么

  • You can install windows server OS with SharePoint and Visual Studio.
  • there is a hack for installing SharePoint 2007 on vista (referenced in the SO article you link to)
  • you can install SharePoint Foundation 2010 on Windows 7 (but I am not sure what the licensing restrictions are - is this maybe something thats given through MSDN?)
  • 您可以使用 SharePoint 和 Visual Studio 安装 Windows 服务器操作系统。
  • 在 vista 上安装 SharePoint 2007 有一个技巧(在您链接到的 SO 文章中引用)
  • 您可以在 Windows 7 上安装 SharePoint Foundation 2010 (但我不确定许可限制是什么 - 这可能是通过 MSDN 提供的吗?)

If you decide to go with the remote server installation then save yourself some grief and use virtualization such as VMWare Server, Virtual PC or Hyper-V.

如果您决定使用远程服务器安装,那么请为自己省去一些麻烦并使用虚拟化,例如 VMWare Server、Virtual PC 或 Hyper-V。

回答by John Ptacek

If you are doing SharePoint development trying to reference the Microsoft.SharePoint namespaces you need to have SharePoint installed on the machine if you want to do things like debugging, etc. For SP 2010 you CAN install SharePoint on a Win 7 machine. For previous versions of SharePoint, you will need to setup a Server that is Server 2003 or Server 2008 (you can't install SP 2007 and earlier on client machines). Generally this is a Virtual Machine for developers.

如果您正在尝试引用 Microsoft.SharePoint 命名空间的 SharePoint 开发,如果您想要执行调试等操作,您需要在机器上安装 SharePoint。对于 SP 2010,您可以在 Win 7 机器上安装 SharePoint。对于以前版本的 SharePoint,您需要设置一个服务器,它是 Server 2003 或 Server 2008(您不能在客户端计算机上安装 SP 2007 及更早版本)。通常这是开发人员的虚拟机。

Having said all of that, there are relatively few reasons you need SharePoint to develop a WebPart. The vast majority of the WebPart functionality is part of the System.Web.UI.WebControls.WebPartsnamespace. Even if I am accessing SharePoint data, I generally use the ASP.NET web part.

说了这么多,您需要 SharePoint 来开发 WebPart 的原因相对较少。绝大多数 WebPart 功能是System.Web.UI.WebControls.WebParts命名空间的一部分。即使我正在访问 SharePoint 数据,我通常也会使用 ASP.NET Web 部件。

If you are trying to use the new SharePoint VS 2010 functionality to create Visual Web Parts, etc, then you will need to install SP 2010, since that functionality is not supported in earlier version of SharePoint.

如果您尝试使用新的 SharePoint VS 2010 功能来创建可视 Web 部件等,则需要安装 SP 2010,因为早期版本的 SharePoint 不支持该功能。

John

约翰