如何使用 MSBuild Extension Pack 创建包含应用程序的网站
使用 MSBuild 扩展包 创建网站的正确方法是什么?
我正在尝试使用 MSBuild 扩展包 使用以下目标创建网站。不幸的是我的语法不正确。该目标将抛出异常“InvalidOperationException:指定的路径已存在。\r”。这是添加应用程序后的情况。
我通过更改 WebApplication 项或 VirtualDirectory 项尝试了以下目标的几个不同版本。如果我将 WebApplication 项的 Include 属性更改为“/”以外的其他内容,则创建将起作用。虽然网站创建后我无法启动它,因为 COM 错误 0x800710D8。 (对象标识符不代表有效对象)
<Target Name="ProvisionIIS7WebSite" DependsOnTargets="CreateDeploymentNumber">
<PropertyGroup>
<WebSiteName>$(BaseDeploymentName)$(DeploymentNumber)</WebSiteName>
<PortNumber>$(DeploymentNumber)</PortNumber>
</PropertyGroup>
<ItemGroup>
<WebApplication Include="/">
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</WebApplication>
<VirtualDirectory Include="/">
<ApplicationPath>/</ApplicationPath>
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</VirtualDirectory>
</ItemGroup>
<!-- Create new site -->
<MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create"
Name="$(WebSiteName)"
Port="$(PortNumber)"
Path="$(WebSitePath)"
AppPool="$(WebSiteAppPool)"
Applications="@(WebApplication)"
VirtualDirectories="@(VirtualDirectory)">
<Output TaskParameter="SiteID" PropertyName="WebSiteID" />
</MSBuild.ExtensionPack.Web.Iis7Website>
<Message Text="Created website with ID $(WebSiteID)" />
</Target>
What is the correct way to create a web site using the MSBuild Extension Pack?
I'm trying to use the MSBuild Extension Pack to create a web site using the following target. Unfortunately I don't have the syntax correct. This target will throw an exception saying "InvalidOperationException: The specified path already exists.\r". This is after adding the application.
I've tried several different versions of the below target by changing the WebApplication item or the VirtualDirectory item. If I change the Include attribute for the WebApplication item to be something other than "/" then the creation will work. Although once the web site is created I can't start it because of COM error 0x800710D8. (The object identifier does not represent a valid object)
<Target Name="ProvisionIIS7WebSite" DependsOnTargets="CreateDeploymentNumber">
<PropertyGroup>
<WebSiteName>$(BaseDeploymentName)$(DeploymentNumber)</WebSiteName>
<PortNumber>$(DeploymentNumber)</PortNumber>
</PropertyGroup>
<ItemGroup>
<WebApplication Include="/">
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</WebApplication>
<VirtualDirectory Include="/">
<ApplicationPath>/</ApplicationPath>
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</VirtualDirectory>
</ItemGroup>
<!-- Create new site -->
<MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create"
Name="$(WebSiteName)"
Port="$(PortNumber)"
Path="$(WebSitePath)"
AppPool="$(WebSiteAppPool)"
Applications="@(WebApplication)"
VirtualDirectories="@(VirtualDirectory)">
<Output TaskParameter="SiteID" PropertyName="WebSiteID" />
</MSBuild.ExtensionPack.Web.Iis7Website>
<Message Text="Created website with ID $(WebSiteID)" />
</Target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个有效的别名,才能尝试
此处进一步讨论
You need a valid alias, to try
Discussed further here