在 Visual Studio 2010 中导入解决方案期间以及应用 Web 模板时出错
我正在尝试将解决方案从 wsp 文件导入到 Visual Studio 2010 中的 SharePoint 2010 项目中。该解决方案文件来自我使用网站的“安全模板”选项导出的网站模板。
选择我导出的解决方案文件并指定我要导入的单个项目(我选择全部)后,Visual Studio 开始导入该解决方案。当它完成最后一项时,它会显示一条错误消息:
SharePoint 解决方案导入操作已完成,但出现错误。因此,该项目可能无法成功部署。
为了检查导入是否正常或损坏,我再次打包了解决方案,并尝试通过代码重新部署它,方法是创建一个新的网站集,将解决方案文件(与 Visual Studio 打包)作为用户解决方案(沙盒解决方案)上传到网站集,激活解决方案的所有功能并将 Web 模板应用到网站集的根网站。在应用模板时,需要很长时间才能出现 SPException 并显示以下消息:
<nativehr>0x80131600</nativehr><nativestack></nativestack>
内部异常的消息并不是真的更好,它说:
<nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>
StackTrace:
[COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +0
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +172
[SPException: <nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27257906
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +27639363
Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) +1218
Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError) +1870
Microsoft.SharePoint.ApplicationPages.TemplatePickPage.BtnSubmit_Click(Object sender, EventArgs e) +129
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
要验证错误是由解决方案导入或打包过程产生的,我使用相同的代码创建网站集,但这次使用原始 wsp 文件,该文件未导入 Visual Studio 并再次打包。这次网页模板可以应用,不会出现任何错误。
所以我想知道当我将解决方案导入 Visual Studio 或再次打包解决方案时我做错了什么。
I'm trying to import a solution from a wsp-file into a SharePoint 2010 project in Visual Studio 2010. The solution file results from a site template I exported using the "safe as template" option of a website.
After selecting the solution file I exported and specifying the single items I want to import (I select all), Visual Studio starts to import the solution. When it finished with the last item it shows an error message saying:
The SharePoint solution import operation completed, but with errors. As a result, the project may not deploy successfully.
To check whether the import was OK or corrupted I packaged the solution again and try to redeploy it via code by creating a new website collection, uploading the solution file (packaged with Visual Studio) as an user solution (sandboxed solution) to the website collection, activating all features of the solution and applying the web template to the site collection's root website. At the point where the template is applied it takes a long time till a SPException occurs with the following message:
<nativehr>0x80131600</nativehr><nativestack></nativestack>
The inner exception's message is not really better, it says:
<nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>
StackTrace:
[COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +0
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +172
[SPException: <nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27257906
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +27639363
Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) +1218
Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError) +1870
Microsoft.SharePoint.ApplicationPages.TemplatePickPage.BtnSubmit_Click(Object sender, EventArgs e) +129
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
To validate that the error results from the solution import or packaging process I used the same code to create a website collection but this time using the original wsp-file which was not imported into Visual Studio and packaged again. And this time the web template can be applied without any error.
So I'm wondering what I'm doing wrong when I imported the solution into Visual Studio or when I packaged the solution again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在导入后检查 Visual Studio 输出窗口,您可能会在“SharePoint 工具”输出中看到类似的
内容 要导入的项目总数:161
成功导入的商品总数:158
由于错误而未导入的项目总数:3
然后,如果您向上滚动详细说明正在导入的内容的行,您将看到每个失败项目的描述性错误。
就我而言,是
这已经足够清楚了。
我只是使用靠近系统根目录的项目路径重新创建了项目,并且导入成功。
If you check the Visual Studio output window after the import, you'll likely see something like this in the "SharePoint Tools" output
Total number of items to import: 161
Total number of items imported successfully: 158
Total number of items not imported due to errors: 3
Then if you scroll up in the lines that are detailing what is being imported, you'll see descriptive errors of each item that failed.
In my case, it was
Which is clear enough.
I simply recreated the project with a project path close to the system root, and it imported successfully.