目标“_WPPCopyWebApplication”项目中不存在
我正在创建一个构建脚本来自动将我们的 Web 项目发布到测试机器。
我有一个成功执行此操作的 msbuild 脚本,但是当它运行时,它会为解决方案中的每个项目生成一个错误,指出“项目中不存在目标“_WPPCopyWebApplication””。
这是正确的,因为在我的每个项目文件中,我没有导入包含此函数的相关 .targets 文件。
如果我确实更改每个项目文件以导入 .targets 文件,那么我会收到每个项目的警告,指出
MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" 不能, 而不是错误它已在“MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (354,3)”处导入
,这很可能是后续导入的错误。 有
目前,我在构建脚本的顶部导入相关的 .targets 文件:
<Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project ="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets"/>
没有办法防止出现“_WPPCopyWebApplication”不存在于项目文件中的错误,而不生成说明存在重复的警告。将其添加到每个项目文件后导入?
如果在构建脚本的顶部导入目标文件,为什么项目需要导入目标文件?
编辑:
我目前正在使用 _WPPCopyWebApplication,如下所示:
<Target Name="Publish" >
<RemoveDir Directories="$(OutputFolder)" ContinueOnError="true" />
<MSBuild Projects="myproject.csproj;anotherproject.csproj" Targets="ResolveReferences;_WPPCopyWebApplication" Properties="WebProjectOutputDir=$(OutputFolder);OutDir=$(WebProjectOutputDir)\" />
</Target>
I am creating a build script to automate the publishing of our web projects to a testing machine.
I have a msbuild script which successfully does this, however when it is running it generates an error for each project in the solution stating that "The target "_WPPCopyWebApplication" does not exist in the project".
It is correct because in each of my project files I do not import the relevant .targets file that contains this function.
If I do change each of the project files to import the .targets file then instead of the errors I get a warning for each project stating that
MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" cannot be imported again.
It was already imported at "MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (354,3)". This is most likely a build authoring error. This subsequent import will be ignored.
At the moment I import the relevant .targets files at the top of my build script:
<Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project ="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets"/>
Is there a way to prevent the error stating that the "_WPPCopyWebApplication" is not present in the project file without generating the warning stating that there are duplicate imports after I add it to each project file?
Why do the projects need to import the targets file if it is imported at the top of my build script?
Edit:
I am currently using _WPPCopyWebApplication like this:
<Target Name="Publish" >
<RemoveDir Directories="$(OutputFolder)" ContinueOnError="true" />
<MSBuild Projects="myproject.csproj;anotherproject.csproj" Targets="ResolveReferences;_WPPCopyWebApplication" Properties="WebProjectOutputDir=$(OutputFolder);OutDir=$(WebProjectOutputDir)\" />
</Target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您收到该错误是因为 Microsoft.WebApplication.targets 已导入 Microsoft.Web.Publishing.targets。
http://www.asp.net/web-forms/tutorials/deployment/web-deployment-in-the-enterprise/building-and-packaging-web-application-projects
You are getting that error because Microsoft.WebApplication.targets already imports Microsoft.Web.Publishing.targets.
http://www.asp.net/web-forms/tutorials/deployment/web-deployment-in-the-enterprise/building-and-packaging-web-application-projects