目标“_WPPCopyWebApplication”项目中不存在

发布于 2024-11-29 12:45:10 字数 1642 浏览 0 评论 0原文

我正在创建一个构建脚本来自动将我们的 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>

Which I got from here and here:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日暮斜阳 2024-12-06 12:45:10

您收到该错误是因为 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

WPP 如何运作?

Microsoft.WebApplication.targets 文件依次导入Microsoft.Web.Publishing.targets 文件。 Microsoft.Web.Publishing.targets 文件本质上是 WPP。它定义了调用 Web Deploy 来完成各种部署任务的目标,例如 PackageMSDeployPublish

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

How Does the WPP Work?

The Microsoft.WebApplication.targets file in turn imports the Microsoft.Web.Publishing.targets file. The Microsoft.Web.Publishing.targets file essentially is the WPP. It defines targets, like Package and MSDeployPublish, that invoke Web Deploy to complete various deployment tasks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文