MSBuild 执行目标 WebDirectoryCreate 时出错
我正在尝试使用 MSBuildCommunityTasks 中的 WebDirectoryCreate
任务来创建我的虚拟目录使用 MSBuild 但它会抛出 Index was out of range
错误。
这是我的构建脚本的相关部分:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
...other build targets working ok...
<Target Name="Deploy">
<RemoveDir Directories="$(DeploymentFolder)$(VerRevision)" ContinueOnError="true" />
<ItemGroup>
<DeploymentFiles Include="$(PublishOutputFolder)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(DeploymentFiles)" DestinationFolder="$(DeploymentFolder)$(VerRevision)\%(RecursiveDir)" />
<WebDirectoryDelete VirtualDirectoryName="$(VirtualDirectory)$(VerRevision)" ContinueOnError="true" />
<WebDirectoryCreate VirtualDirectoryName="$(VirtualDirectory)$(VerRevision)" VirtualDirectoryPhysicalPath="$(DeploymentFolder)$(VerRevision)" />
</Target>
这是相应的输出:
Deleting virtual directory 'MyApp283' on 'localhost:80'.
MSBUILD : warning : The system cannot find the path specified. (Exception from HRESULT: 0x80070003) [D:\build\MyApp\Build.xml]
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "WebDirectoryDelete" is set to "true".
Creating virtual directory named MyApp283 on localhost:
D:\build\MyApp\Build.xml(50,5): error : Index was out of range. Must be non-negative and less than the size of the collection.
D:\build\MyApp\Build.xml(50,5): error : Parameter name: index
Done Building Project "D:\build\MyApp\Build.xml" (default targets) -- FAILED.
Build FAILED.
我通过手动添加虚拟目录并运行构建来检查导入是否正确。在这种情况下,WebDirectoryDelete
任务正确删除虚拟目录,但 WebDirectoryCreate
抛出相同的错误。
我正在使用 MSBuild 从一个简单的批处理文件执行构建。在此任务之前的所有任务都执行得很好。操作系统为Windows Server 2008 R2企业版SP1。
谁能给我任何线索吗? SO 和 Google 抛出了一个链接没有答案。
I'm trying to use the WebDirectoryCreate
task from the MSBuildCommunityTasks to create my virtual directory with MSBuild but it throws an Index was out of range
error.
Here's the relevant part of my build script:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
...other build targets working ok...
<Target Name="Deploy">
<RemoveDir Directories="$(DeploymentFolder)$(VerRevision)" ContinueOnError="true" />
<ItemGroup>
<DeploymentFiles Include="$(PublishOutputFolder)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(DeploymentFiles)" DestinationFolder="$(DeploymentFolder)$(VerRevision)\%(RecursiveDir)" />
<WebDirectoryDelete VirtualDirectoryName="$(VirtualDirectory)$(VerRevision)" ContinueOnError="true" />
<WebDirectoryCreate VirtualDirectoryName="$(VirtualDirectory)$(VerRevision)" VirtualDirectoryPhysicalPath="$(DeploymentFolder)$(VerRevision)" />
</Target>
And here's the corresponding output:
Deleting virtual directory 'MyApp283' on 'localhost:80'.
MSBUILD : warning : The system cannot find the path specified. (Exception from HRESULT: 0x80070003) [D:\build\MyApp\Build.xml]
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "WebDirectoryDelete" is set to "true".
Creating virtual directory named MyApp283 on localhost:
D:\build\MyApp\Build.xml(50,5): error : Index was out of range. Must be non-negative and less than the size of the collection.
D:\build\MyApp\Build.xml(50,5): error : Parameter name: index
Done Building Project "D:\build\MyApp\Build.xml" (default targets) -- FAILED.
Build FAILED.
I have checked the import is correct by adding the virtual directory manually and running the build. In this case the WebDirectoryDelete
task corrcetly deletes the virtual directory but WebDirectoryCreate
throws the same error.
I'm executing the build using MSBuild from a simple batch file. All tasks before this one execute just fine. OS is Windows Server 2008 R2 Enterprise Edition SP1.
Can anyone give me any clues? SO and Google threw up one single link with no answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论