我正在使用Visual Studio 2008,并下载了VSeWSS.exe 1.2,以启用Web部件开发。我是SP开发新手,并且已经被不同版本的SP的数量和VS附加组件所困惑。这个问题已经出现,这突出了我的困惑。VS的SharePoint扩展 - 我得到了哪个版本?
我选择添加 - >新建项目 - >的Visual C# - > SharePoint的> Web部件,接受默认设置,并VS创建了一个项目,与主文件WebPart1.cs
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace WebPart1
{
[Guid("9bd7e74c-280b-44d4-baa1-9271679657a0")]
public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
{
public WebPart1()
{
}
protected override void CreateChildControls() // <-- This line
{
base.CreateChildControls();
// TODO: add custom rendering code here.
// Label label = new Label();
// label.Text = "Hello World";
// this.Controls.Add(label);
}
}
}
这本书我“M以下,基本的SharePoint 2007年,杰夫·韦伯,具有默认的项目如下 -
using System;
<...as previously>
namespace WebPart1
{
[Guid("9bd7e74c-280b-44d4-baa1-9271679657a0")]
public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
{
//^this is a new style (ASP.NET) web part! [author's comment]
protected override void Render(HtmlTextWriter writer) // <-- This line
{
// This method draws the web part
// TODO: add custom rendering code here.
// writer.Write("Output HTML");
}
}
}
我关注的真正原因是,这本书的这一章中笔者经常提到的“老之间的区别风格“的网页部分,以及”新风格“的网页部分,正如他的文章所述评论Render方法。
发生了什么事?为什么我的默认Web部件与作者有不同的签名?
无关:版本1.3可用:http://www.microsoft.com/downloads/details.aspx?familyid=FB9D4B85-DA2A-432E-91FB-D505199C49F6&displaylang=en – 2010-02-05 00:02:56
谢谢。我在安装1.2时遇到了一些麻烦,所以一旦运行,我不想冒1.3版的风险。我已经浏览了1.3版的变更注释,并且他们似乎没有涉及到这个问题。由于1.3在2009年推出,而我的书是2007年,我的VSeWSS或本书的版本不可能是1.3。 – 2010-02-05 01:00:10
我感觉他的(作者的)代码是针对VSeWSS 1.0或1.1的,这就是他所说的“新风格”,我的代码1.2是一种“新的新风格”,并取代它。仍试图找到此版本的“入门指南”。 – 2010-02-05 01:06:51