SharePoint 2010 BDC Model项目部署出错:“The default web application could not be determined.”
前两天在VS2010里面创建了一个Business Data Connectivity Model project,等代码都写完部署的时候却一直报错。
“Error occurred in deployment step 'Add Solution': Property 'SiteUrl' contains an invalid URL. Import failed with the following exception message: The site <site> could not be found in the Web application SPWebApplication Name=<webapplication>.
Parameter name: properties ”
在网上搜了一下,发现这个问题很多人都碰到了,Paul Andrew在这篇文章中给出了解决方案。
解决方案:
打开Solution Explorer,定位到Featuer1.Template.xml(文件名称可能你已经修改过),如下图:
把下面的XML语句添加到Template.xml中,如果已经存在,则替换URL。
<Property Key="SiteUrl" Value="http://localhost/sites/portal"/>
修改完后如下:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key='SiteUrl' Value='http://localhost/sites/portal'/>
</Properties>
</Feature>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key='SiteUrl' Value='http://localhost/sites/portal'/>
</Properties>
</Feature>
然后再部署就可以顺利通过了。
当VS创建SharePoint Solution(WSP文件)的时候,需要用Feature Template XML来生成Feature manifest。