我正在使用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