SharePoint 2010:尝试使用 Power shell 安装 Web 部件时出现问题

发布于 2024-10-02 01:54:30 字数 766 浏览 4 评论 0原文

我正在尝试在 2010 年部署我的第一个 Web 部件。我使用 VS2008 开发了一个 Web 部件,并在 SP2007 上对其进行了测试。

我将 CAB 复制到 2010 服务器并尝试使用 power shell 来安装它:

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 部件的正确方法吗?

I'm trying to deploy my first web part on 2010. I developed a web part using VS2008 and tested it on SP2007.

I copied the CAB to the 2010 server and tried to use the power shell to install it:

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

What am I doing wrong? Is this the right way to install web parts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

变身佩奇 2024-10-09 01:54:30

如果可以的话,我建议您升级到 Visual Studio 2010,它具有对 SharePoint 2010 的内置支持。当您构建从 SharePoint 模板构建的项目时,它将为您创建 wsp。您还可以立即从 VS2010 部署到本地服务器,这样您就无需在本地开发计算机上进入 PowerShell。

当您需要部署到其他服务器时,可以运行

Add-SPSolution -LiteralPath C:\webparts\MyWebPart.wsp 将解决方案添加到中央管理
然后

Install-SPSolution -Identify MyWebPart.wsp -WebApplication http://mySharePointserver 将解决方案部署到指定的网络应用程序

If you can, I recommend you upgrade to Visual Studio 2010 which has built-in support for SharePoint 2010. When you build a project built from the SharePoint template it will create the wsp for you. You can also immediately deploy to the local server from VS2010 so you never need to get into PowerShell on your local development machine.

When you need to deploy to a different server, you can then run

Add-SPSolution -LiteralPath C:\webparts\MyWebPart.wsp to add the solution to Central Administation
and then

Install-SPSolution -Identify MyWebPart.wsp -WebApplication http://mySharePointserver to deploy the solution to the specified web application

会发光的星星闪亮亮i 2024-10-09 01:54:30

这是我发现的第一篇提供实际答案的文章,但是,在 Install-SPSolution 中,有一个 typeo,-Indentify 参数应该是 -Identity

另外,在大多数情况下(如果添加到 GAC)需要添加-GACDeployment 到 Install-SPSolution。

所以该行应该如下所示:
安装-SPSolution -Identity BasicWebPart.wsp -WebApplication http://vsp -GACDeployment

This was the first article I found that provided the actual answer, however, in the Install-SPSolution, there is a typeo, the -Indentify parameter should be -Identity

Also, in most cases (if adding to the GAC) need to add the -GACDeployment to the Install-SPSolution.

So the line should look like:
Install-SPSolution -Identity BasicWebPart.wsp -WebApplication http://vsp -GACDeployment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文