在.Net 4.8.2上构建Azure Webjob v3?可以吗?

问题描述 投票:0回答:1

我有一个在 .NET 4.8.2 上运行的 ASP.NET MVC 应用程序。我还无法更新到 .NET Core。所以我被困在 ASP.NET MVC 和 .NET 4.8.2 上。

我的应用程序有一个连续的 Web 作业,我在 Azure DevOps 上构建整个解决方案(实际上使用本地代理)。

这一直工作得很好,直到我因为硬盘损坏而不得不重新映像我的本地计算机。当我重新安装本地代理时,我开始在构建 Web 应用程序时遇到问题 - 项目的其余部分构建得很好。

在我的本地开发环境中,我能够很好地构建整个解决方案。我正在使用 VS 2022 社区版。

我在构建 Web 作业项目时在 Azure DevOps 上遇到的错误是找不到

project.assets.json
。我不知道这个文件应该是什么,但它在我的项目中不存在。

我可以看到它似乎使用 .NET 8 作为构建环境,这是不正确的。

Web 作业项目面向 .NET 4.8.2(已在项目属性中进行验证)。

Web 作业项目是一个新样式的项目文件(具有依赖项和

Properties
文件夹),而不是引用和属性项。

我还有一个非连续的网络作业项目,但它使用旧样式的项目。我相信它仍然构建得很好。

这是我在构建系统上遇到的错误:

 18>GenerateTargetFrameworkMonikerAttribute:
       Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
       CoreCompile:
         C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\AutoMapper.10.1.1\lib\net461\AutoMapper.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Azure.Core.1.43.0\lib\net472\Azure.Core.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Azure.Storage.Blobs.12.22.1\lib\netstandard2.0\Azure.Storage.Blobs.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Azure.Storage.Common.12.21.0\lib\netstandard2.0\Azure.Storage.Common.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\Resources\bin\Release\CommonResources.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\HttpMultipartParser.8.4.0\lib\net48\HttpMultipartParser.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.AspNet.Identity.Core.2.2.4\lib\net45\Microsoft.AspNet.Identity.Core.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.4\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Azure.KeyVault.Core.3.0.5\lib\net461\Microsoft.Azure.KeyVault.Core.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Microsoft.CSharp.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Configuration.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Configuration.Binder.7.0.4\lib\net462\Microsoft.Extensions.Configuration.Binder.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Configuration.7.0.0\lib\net462\Microsoft.Extensions.Configuration.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.DependencyInjection.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Logging.8.0.0\lib\net462\Microsoft.Extensions.Logging.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Options.8.0.0\lib\net462\Microsoft.Extensions.Options.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.IO.RecyclableMemoryStream.3.0.0\lib\netstandard2.0\Microsoft.IO.RecyclableMemoryStream.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.19\lib\net461\Microsoft.Rest.ClientRuntime.Azure.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.Rest.ClientRuntime.2.3.24\lib\net461\Microsoft.Rest.ClientRuntime.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\MimeTypesMap.1.0.8\lib\net452\MimeTypesMap.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\NodaTime.3.1.9\lib\netstandard2.0\NodaTime.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Pathoschild.Http.FluentClient.4.4.1\lib\net452\Pathoschild.Http.Client.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\SkyCourt.App.Utilities\bin\Release\SkyCourt.App.Utilities.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Stripe.net.40.2.0\lib\net461\Stripe.net.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.ClientModel.1.0.0\lib\netstandard2.0\System.ClientModel.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.ComponentModel.DataAnnotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Drawing.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.IO.Hashing.7.0.0\lib\net462\System.IO.Hashing.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Memory.Data.7.0.0\lib\net462\System.Memory.Data.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Net.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Net.Http.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Text.Json.8.0.4\lib\net462\System.Text.Json.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Web.dll" /reference:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\packages\Microsoft.AspNet.WebApi.Core.5.3.0\lib\net45\System.Web.Http.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\netstandard.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\SkyCourt.App.Models.dll /subsystemversion:6.00 /target:library /utf8output /langversion:7.3 /analyzerconfig:C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\.editorconfig Cart\Cart.cs ClassLibraries\FilePostParsing\InMemoryMultipartFormDataStreamProvider.cs ClassLibraries\FileStorage\FileStorageBase.cs ClassLibraries\FileStorage\GenericFileStorage.cs ClassLibraries\FileStorage\ImageFileStorage.cs ClassLibraries\FileStorage\FileUploadProvider.cs ClassLibraries\FileStorage\ImageUploadProvider.cs ClassLibraries\FileStorage\IStorageContainer.cs ClassLibraries\CompetitorPointsSorting\CompetitorPointsSorter.cs ClassLibraries\Questions\Answer.cs ClassLibraries\Questions\QuestionsWithAnswers.cs ClassLibraries\Questions\Question.cs ClassLibraries\RegexUtilities\RegexUtilities.cs ClassLibraries\SkyCourtCourtMapping\ClubTeamLeagueCourtMapperFactory.cs ClassLibraries\SkyCourtCourtMapping\ClubTeamLeagueCustomOrderCourtMapper.cs ClassLibraries\SkyCourtCourtMapping\ClubTeamLeagueCourtMapper.cs ClassLibraries\SkyCourtCourtMapping\ClubTeamLeaguePositionBasedCourtMapper.cs ClassLibraries\SkyCourtCourtMapping\CourtMapperBase.cs ClassLibraries\SkyCourtCourtMapping\SessionLeagueCourtMapper.cs ClassLibraries\SkyCourtCourtMapping\ScrambleLeagueCourtMapper.cs ClassLibraries\SkyCourtCourtMapping\HouseLeagueCourtMapper.cs ClassLibraries\SkyCourtScheduler\ScheduledMatchupInfo.cs ClassLibraries\SkyCourtScheduler\SingleRoundRobinBalancedMatchScheduler.cs ClubEvents\ClubEvent.cs ClubEvents\ClubEventLog.cs ClubEvents\EventDoc.cs ClubEvents\ClubEventSession.cs ClubEvents\EventManager.cs ClubEvents\EventRegistrant.cs ClubEvents\EventWaiver.cs Common\LargeNote.cs Competition\PartnerScramble\PartnerScrambleHelper.cs Competition\SportsTypeOperations.cs Configuration\ISkyCourtConfiguration.cs CourtBooking\CourtBookingCancelation.cs CourtBooking\CourtBookingCapturedFee.cs CourtBooking\CourtBookingMemberPayMethod.cs CourtBooking\CourtBookingSchedule.cs CourtBooking\CourtGroupSharedCourt.cs CourtBooking\CourtMultiBooking.cs CourtBooking\DailyStartEndTimes.cs CourtBooking\CourtScheduleInfo.cs CourtBooking\ICourtBookingOperations.cs CourtBooking\ICourtFeeQueue.cs Enums\DateTimeFormat.cs Enums\ActivityState.cs Enums\SCDayOfWeek.cs Enums\SkyCourtStatuses.cs FeeProcessing\EventFee.cs FeeProcessing\IPaymentProcessor.cs FeeProcessing\Purchasable.cs FeeProcessing\PurchaseablePurchaseList.cs FeeProcessing\SignUpLimit.cs FeeProcessing\OfflinePaymentProcessor.cs FeeProcessing\StripePaymentProcessor.cs FeeProcessing\PurchaseFailure.cs Helpers\DateTimeHelpers.cs Helpers\IdObject.cs Configuration\ISkyCourtUrlHelper.cs Helpers\StringHelpers.cs Activities\EventRecurrence.cs Ads\AdImage.cs Ads\AdOwner.cs Ads\AdSet.cs ClassLibraries\FileStorage\IFileStorage.cs Ads\SingleAdSet.cs ClubServices\ClubService.cs ClubServices\ClubServiceEvent.cs ClubServices\ClubServiceGlobalSettings.cs ClubServices\ClubServiceRule.cs Communication\Announcements.cs Communication\CommsEmailDraft.cs Communication\CommsEmailLog.cs Communication\CommsFilter.cs Communication\CommsPermittedUser.cs Communication\PaperSize.cs Competition\Competitor.cs Competition\Event.cs Competition\Matches\EventNote.cs Competition\Matches\MatchResult.cs Competition\RoundRobins\RoundRobin.cs Competition\RoundRobins\RoundRobinMatch.cs Competition\RoundRobins\RoundRobinCompetitor.cs Competition\SportsType.cs CourtBooking\Court.cs CourtBooking\CourtBookingCustomType.cs CourtBooking\CourtBookingPackage.cs CourtBooking\CourtBookingRules.cs CourtBooking\CourtBookingStartEndTimes.cs CourtBooking\CourtBookingType.cs CourtBooking\CourtGroup.cs CourtBooking\CourtScheduleCarousel.cs CourtBooking\CourtScheduleSideBySide.cs CourtBooking\CourtSingleBooking.cs FeeProcessing\CardConnectFactory.cs FeeProcessing\LeagueFee.cs FeeProcessing\StripeApi.cs FeeProcessing\SupportedCurrency.cs Helpers\CurrencyHelpers.cs IdentityModels.cs Kiosk\KioskSettings.cs Leagues\BoxLeagues\BoxLeagueChatMapper.cs Leagues\ChallengeLadders\ChallengeLadderChallenge.cs Leagues\Common\ActivityCartOptions.cs Leagues\Common\ActivityFee.cs Leagues\Common\ActivityNote.cs Leagues\DropIn\DropInLeague.cs Leagues\DropIn\DropInLeagueResult.cs Leagues\DropIn\DropInPeriodGroup.cs Leagues\DropIn\DropInPeriodGroupMatch.cs Leagues\DropIn\DropInPeriodGroupPlayer.cs Leagues\DropIn\DropInPlayPeriodSkip.cs Leagues\DropIn\DropInLeagueSignUp.cs Leagues\DropIn\DropInPlayPeriod.cs Leagues\Scramble\ScrambleAvailability.cs Leagues\Scramble\ScramblePlayer.cs Leagues\SessionLeagues\SessionLeagueChatBuilder.cs Leagues\SessionLeagues\SessionLeagueScheduling.cs Leagues\Common\CompetitorsInLeague.cs Leagues\BoxLeagues\BoxLeague.cs Leagues\SessionLeagues\SessionBasedLeague.cs Leagues\SessionLeagues\LeagueSession.cs Leagues\ChallengeLadders\RatingsChallengeLadder.cs Leagues\ClubTeamLeagues\ClubTeamLeague.cs Leagues\ClubTeamLeagues\ClubTeamLeagueMissingPlayer.cs Leagues\ClubTeamLeagues\TeamLeagueCourtMapping.cs Leagues\HouseLeagues\HouseLeague.cs Leagues\InterCityLeagues\InterCityLeague.cs Leagues\TeamLeagues\TeamLeagueScheduleOrder.cs Leagues\InterCityLeagues\InterCityTeam.cs CourtBooking\CourtBlockListing.cs Leagues\Common\League.cs Leagues\Common\League2UpDisplays.cs Leagues\Common\LeagueCourtBooking.cs Leagues\Common\LeagueFactory.cs Leagues\Common\ActivityManager.cs Leagues\Common\LeaguePublicPageSettings.cs Leagues\Common\ActivityType.cs Leagues\Common\PlayersInLeague.cs Leagues\ScoringSystems\ScoringSystem.cs Leagues\ScoringSystems\ScoringPreset.cs Leagues\BoxLeagues\SponsorLayout.cs Leagues\Scramble\ScrambleLeague.cs Leagues\TeamLeagues\LeagueTeam.cs Leagues\TeamLeagues\TeamLeagueBase.cs Leagues\TeamLeagues\TeamLeagueDivision.cs Leagues\TeamLeagues\TeamLeagueSchedule.cs Leagues\TeamLeagues\TeamLeagueTeam.cs Leagues\TeamLeagues\TeamLineup.cs Leagues\TeamLeagues\TeamMatchResult.cs Merch\MerchProduct.cs Merch\MerchProductLog.cs Merch\MerchPurchase.cs Messaging\BaseMessage.cs Messaging\Chat.cs Messaging\ChatMembership.cs Messaging\ChatMessage.cs Messaging\LeagueChat.cs Messaging\LeagueSessionChat.cs Messaging\MessageGroupManager.cs Messaging\PendingEmailOperations.cs Messaging\PendingEmail.cs Messaging\SentEmailEventOperations.cs Messaging\SentEmailEvent.cs Messaging\UserChat.cs Organization\MemberInfo.cs FeeProcessing\PaymentMethodChangeRecord.cs Utilities\NumberRange.cs Organization\OrganizationAppearance.cs Organization\OrganizationFamily.cs Organization\OrganizationFamilyOperations.cs Organization\OrganizationInfo.cs Organization\OrganizationLicenses.cs Organization\OrganizationMemberExpiration.cs Organization\OrganizationMemberLog.cs Organization\OrganizationMemberNote.cs Organization\OrganizationMembership.cs Organization\OrganizationMembershipSubscription.cs Organization\OrganizationMemberType.cs Organization\OrganizationMemberTypeOperations.cs FeeProcessing\PaymentOperations.cs Organization\OrganizationPaymentSettings.cs Organization\OrganizationRelationship.cs Organization\OrganizationSubscriptionOperations.cs Organization\OrganizationSupportedSportOperations.cs Organization\SmartTypeOperations.cs Organization\OrganizationSupportedSport.cs Organization\OrganizationMembershipPackage.cs PaymentProcessing\BookkeepingAccount.cs PaymentProcessing\OrgStripeConnection.cs Organization\SupportedCountry.cs PaymentProcessing\PaymentProcessorCustomer.cs PaymentProcessing\StripePayout.cs Ratings\ClubHiddenRatedPlayer.cs Ratings\ClubPlayerRanking.cs Ratings\PlayerEloAdjustment.cs Ratings\PlayerELOStatus.cs SkyCourtContext.cs SkyCourtContext.Views.cs User\OpponentFinder.cs Properties\AssemblyInfo.cs User\UserPreferredSport.cs User\UserPrivatePlayerNotes.cs User\UserProfile.cs Utilities\Response.cs Waivers\Waiver.cs "obj\Release\.NETFramework,Version=v4.8.AssemblyAttributes.cs"
##[error]C:\Program Files\dotnet\sdk\8.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): Error NETSDK1004: Assets file 'C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\WebJobImmediateTasks\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
     1>Project "C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\SkyCourt.sln" (1) is building "C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\WebJobImmediateTasks\WebJobImmediateTasks.csproj" (34) on node 2 (default targets).
    34>C:\Program Files\dotnet\sdk\8.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1004: Assets file 'C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\WebJobImmediateTasks\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\WebJobImmediateTasks\WebJobImmediateTasks.csproj]
    34>Done Building Project "C:\Users\Greg\source\SkyCourtAgent\_work\1\s\SquashSpider\WebJobImmediateTasks\WebJobImmediateTasks.csproj" (default targets) -- FAILED.

注意对“dotnet\sdk\8.0.400”的引用。

关于如何在构建环境中正确构建此建筑有什么建议吗?

.net asp.net-mvc-4 azure-devops azure-webjobs
1个回答
0
投票

Azure WebJobs SDK 3.x最初是为.NET Core设计的,但仍然可以与.NET Framework 4.6.1及更高版本一起使用

  • 它允许将 WebJobs SDK v3.x 与面向 .NET Framework 4.8.2 的项目一起使用,但您需要确保包和依赖项方面的兼容性。

NuGet Package Manager

中安装以下内容
Install-Package Microsoft.Azure.WebJobs -Version 3.x
Install-Package Microsoft.Azure.WebJobs.Extensions -Version 3.x
Install-Package Microsoft.Azure.WebJobs.Extensions.Storage -Version 3.x

网络作业代码:

using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;

public class Functions
{
    public static void ProcessBlob(
        [BlobTrigger("samples-workitems/{name}")] Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
    }
}

程序.cs:

using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Hosting;

class Program
{
    static void Main(string[] args)
    {
        var builder = new HostBuilder()
            .ConfigureWebJobs(b =>
            {
                b.AddAzureStorageCoreServices();
                b.AddAzureStorage();
            })
            .ConfigureLogging((context, b) =>
            {
                b.SetMinimumLevel(LogLevel.Information);
            });

        var host = builder.Build();
        using (host)
        {
            host.Run();
        }
    }
}

YAML 文件:

trigger:
- main

pool:
  vmImage: 'windows-latest'

steps:
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '4.8.x'
    installationPath: $(Agent.ToolsDirectory)/dotnet

- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'

- task: VSBuild@1
  inputs:
    solution: '**/*.sln'
    msbuildArgs: '/p:Configuration=Release'
    platform: 'Any CPU'

- task: VSTest@2
  inputs:
    testAssemblyVer2: |
      **\*test*.dll
      !**\*TestAdapter.dll
      !**\obj\**

发布管道:

enter image description here

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.