Search code examples
.netasp.net-mvc-4azure-devopsazure-webjobs

Build Azure Webjob v3 on .Net 4.8.2? Is it possible?


I have an ASP.NET MVC app running on .NET 4.8.2. I can't update to .NET Core yet. So I am stuck on ASP.NET MVC and .NET 4.8.2.

My app has a continuous web job and I build the entire solution on Azure DevOps (actually using a local agent).

This had been working great until I had to re-image my local machine because the hard drive got corrupted. When I re-installed the local agent, I started to have a problem building the web app - the rest of the project builds great.

And in my local dev environment, I am able to build the entire solution just fine. I am using VS 2022 Community edition.

The error I am getting on Azure DevOps when building the web job project is that project.assets.json is not found. I don't know what this file is supposed to be, but it doesn't exist in my project.

I can see that it appears to be using .NET 8 as the build environment, which is not correct.

The web job project is targeting .NET 4.8.2 (as verified in the properties for the project).

The web job project is a new style project file (has the dependencies and Properties folder) rather than the references and properties items.

I also have a non-continuous web job project but it uses the old style project. I believe it still builds fine.

Here is the error that I am getting on the build system:

 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.

Notice the reference to 'dotnet\sdk\8.0.400.

Any suggestions on how to get this building properly on the build environment?


Solution

  • I found the build problem answer here.

    I believe this is what is going on when you try to use the webjob v3 libraries with an ASP.NET MVC application that is running on .NET 4.8:

    Your main app is limited to running C# 7.3 and you have no support for .NET Core in your solution. However, the webjob v3 libraries are .NET Core libraries and need some additional setup in order to be built. There are two things that I have found need to be done in order to get the webjob to build on Azure DevOps and to load and run properly on your production server.

    The first is that you need to run the MSBuild step with the argument of /t:Restore. This will setup your project with the necessary build tools. You can tell you need to do this if you get a build error saying that project.assets.json is not found. Running the restore step fixes that issue.

    For me, I had to add a new build step because once I put the restore argument in the MSBuild Arguments field, that was the only thing that was performed for that build step. This meant that my project wasn't actually getting built. So, what I did was cloned my build step and then changed the first build step to have just the /t:Restore MSBuild Argument and the second build step was identical to what I had before so that it would do the actual build.

    The second step that I found I had to do was to add a number of NuGet packages to my WebJob project. Even though the build would happen fine if I didn't include them, I would get a message at runtime that the DLL couldn't be found. Once I installed the NuGet package for the reference, then the DLL would be found. To be clear, my WebJob pulls in projects from the main solution (the main solution is not .NET Core). I am guessing that by doing this I was installing a .NET Core version of these libraries because when I was installing the NuGet packages, Visual Studio told me that it was downloading missing packages even though the packages are already part of my solution and should have been in the cache.

    Once all of that was done and the binding redirects were all in place properly, the webjob built on the CI server, was deployed properly to the production server and runs properly on the production server, allowing the .NET Core webjob to run beside the ASP.NET MVC main solution.