gpt4 book ai didi

visual-studio - 从 Visual Studio 发布到 Azure 时,"The target ' AddScheduledJob ' does not exist in the project"

转载 作者:行者123 更新时间:2023-12-03 04:17:12 24 4
gpt4 key购买 nike

我的解决方案由一个主 Web 应用程序组成,并附加了几个 Azure Web 作业。当我发布主 Web 应用程序时,我收到此错误:

[project_path]\[project_name].csproj(0,0): Error MSB4057: The target "AddScheduledJob" does not exist in the project.

我不确定 AddScheduledJob 来自哪里。它不是解决方案中任何项目的名称。

我想我已经找到了“试图”引用这个虚拟项目的文件:

[solution_path]\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets

此文件包含以下文本片段:

 <Target Name="AddScheduledJob"
DependsOnTargets="$(AddScheduledJobDependsOn)"
AfterTargets="MSDeployPublish"
Condition="'$(FilePreview)' == 'false' and ('$(WebJobPublishFromWAP)' == 'true' or '$(_DestinationType)' == 'AzureWebSite')">

<CreateScheduledWebJob JobConfig="@(JobConfig)"
WebSiteName="$(WebSiteName)"
WebSiteUrl="$(WebSiteUrl)"
ManagementUri="$(WebJobManagementUri)"
ManagementCertificatePath="$(ManagementCertificatePath)"
ManagementCertificatePassword="$(ManagementCertificatePassword)"
ManagementCertificate="$(ManagementCertificate)"
ManagementToken="$(ManagementToken)"
PublishSettingsPath="$(PublishSettingsPath)"
SubscriptionId="$(SubscriptionId)"
Condition="'%(RunMode)' == 'Scheduled'"/>

我不知道这是从哪里来的,也不知道为什么会导致问题。我很想删除该片段,但在文件顶部,我读到了以下片段:

WARNING:  DO NOT MODIFY this file, this file is added to your project automatically...

我可以安全地从“webjobs.console.targets”文件中删除此代码片段吗?或者,还有其他可能发生的事情吗?

更新

我发现即使出现此错误,我的网络应用程序仍能成功发布。以下是发布过程结束时日志的更深入 View :

Adding ACLs for path (ringclone-test/App_Data)
Publish Succeeded.
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.12\tools\webjobs.console.targets (25,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\TicketProcessor\TicketProcessor.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.12\tools\webjobs.console.targets (25,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\TicketDistributor\TicketDistributor.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.12\tools\webjobs.console.targets (25,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\ArchiveIndexer\ArchiveIndexer.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.console.targets (24,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\Starter\Starter.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.console.targets (24,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\NrtTrigger\NrtTrigger.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.12\tools\webjobs.console.targets (25,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\DownloadProcessor\DownloadProcessor.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.console.targets (24,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\DatabaseReIndexer\DatabaseReIndexer.csproj]
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(110,5): Error : An error occurred while creating the WebJob schedule: Webjob configuration is missing metadata for StartTime
C:\APD\RingClone\DailyMaintenance\DailyMaintenance.csproj(0,0): Error MSB4057: The target "AddScheduledJob" does not exist in the project.
C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.7\tools\webjobs.console.targets(25,3): Warning MSB4011: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" cannot be imported again. It was already imported at "C:\APD\RingClone\packages\Microsoft.Web.WebJobs.Publish.1.0.12\tools\webjobs.console.targets (25,3)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\APD\RingClone\ScheduledTrigger\ScheduledTrigger.csproj]

如您所见,它显示“发布成功”,然后提示其中一项作业的“开始时间”。然后提示“AddScheduledJob”。我不关心“StartTime”问题。我可以解决这个问题。但有关名为“AddScheduledJob”的项目的错误令人费解。尽管发布似乎发生了,但我不希望这个错误使日志变得困惑。是什么导致了这个错误?

最佳答案

这是一个古老的 NuGet 包。在旧版本中,如果您将 Web 作业配置为按计划运行而不是连续运行,则 Visual Studio 将允许您配置 Web 作业的计划。您可以使用以下指南删除该目标并配置计划:https://learn.microsoft.com/en-us/azure/app-service/web-sites-create-web-jobs#CreateScheduledCRON 。如果您使用的是旧版本的 Visual Studio,请升级以便拥有最新的 WebJob 项目模板。

关于visual-studio - 从 Visual Studio 发布到 Azure 时,"The target ' AddScheduledJob ' does not exist in the project",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51992994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com