2010-11-15 33 views
0

我試圖在2010年部署我的第一個Web部件。我開發了一個使用VS2008的Web部件並在SP2007上對其進行了測試。SharePoint 2010:嘗試使用電源外殼安裝Web部件的問題

我複製CAB到2010服務器,並試圖使用電源外殼進行安裝:

PS C:\Users\sa_portalt> Install-SPWebPartPack -LiteralPath "c:\transfer\webparts\redirectwebpart.cab" -Name "RedirectWebPart" 
Install-SPWebPartPack : Parameter set cannot be resolved using the specified named parameters. 
At line:1 char:22 
+ Install-SPWebPartPack <<<< -LiteralPath "c:\transfer\webparts\redirectwebpart.cab" -Name "RedirectWebPart" 
    + CategoryInfo   : InvalidArgument: (:) [Install-SPWebPartPack], ParameterBindingException 
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.SharePoint.PowerShell.SPCmdletInstallWebPartPack 

我在做什麼錯?這是安裝Web部件的正確方法嗎?

回答

2

如果可以,我建議您升級到Visual Studio 2010,它內置了對SharePoint 2010的支持。當您構建一個使用SharePoint模板構建的項目時,它將爲您創建wsp。您也可以立即從VS2010部署到本地服務器,因此您永遠不需要在本地開發機器上進入PowerShell。

當你需要部署到不同的服務器,你可以運行

Add-SPSolution -LiteralPath C:\webparts\MyWebPart.wsp的解決方案添加到中央Administation 然後

Install-SPSolution -Identify MyWebPart.wsp -WebApplication http://mySharePointserver到解決方案部署到指定的Web應用程序

+0

在我們仍然集中在SP2007的時刻。我正在使用SP2010進行初始測試,並且只是想調查我們的Web部件的遷移。我們還沒有VS2010。 – paul 2010-11-16 07:44:18

1

這是我發現的第一篇提供實際答案的文章,但是,在Install-SPSolution中,有一個typeo,-Indentify參數應該是--Identity

另外,在大多數情況下(如果添加到GAC中)需要將-GACDeployment添加到Install-SPSolution。

所以該行應如下所示: 安裝-SPSolution -Identity BasicWebPart.wsp -WebApplication http://vsp -GACDeployment

相關問題