0

I recently upgraded from Umbraco 10.x (.NET 6 Core) to 13.x (.NET 8 Core).

Since then the pipeline to build the project has not been failing or complaining but I suspect it is still building in .NET 6 somehow as it doesn't run. I can also compare the following files after a local publish vs. the pipeline's output.

myproj.deps.json has { "runtimeTarget": { "name": ".NETCoreApp,Version=v6.0" ...

myproj.runtimeconfig.json has { "runtimeOptions" : { "tfm": "net6.0" ...

Local build/publish those have 8.0.

Trying solutions from similar posts I've added a task step of "Use .NET Core"

steps:
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 8.x'
  inputs:
    version: 8.x

I even added a dotnet info to prove that 8 was there:

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet info'
  inputs:
    command: custom
    custom: '--info' 

But when it gets to the build step I get the following error:

steps:
- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '**/myproj.csproj'
    arguments: '--configuration $(BuildConfiguration) --no-restore --framework net8.0'

##[error]C:\hostedtoolcache\windows\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): Error NETSDK1005: Assets file 'D:\a\8\s\Dev\Main\myproj\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project.

Same result with or without --framework net8.0.

Even though I'm not doing NuGet specifically I tried adding the following with no change.

steps:
- task: NuGetToolInstaller@1
  displayName: 'Use NuGet 5.8'
  inputs:
    versionSpec: 5.8

I have also tried changing the host from windows-latest to windows-2022. No change.

I even tried changing the following item in the project file from TargetFramework to TargetFrameworks.

<TargetFramework>net8.0</TargetFramework>

ANY ideas or help would be greatly appreciated.

3
  • 2
    Have you run dotnet restore before the build steps? If not, please try it. Commented May 7, 2024 at 7:48
  • Yes, the full pipeline is currently: (Use NuGet 5.8, Use .NET Core sdk 8.x, dotnot info, dotnet restore, npm install, Use .NET Core sdk 8.x (again), Build, npm build, dotnet publish, Publish Artifact) Extra stuff added in my many desperate attempts. Commented May 7, 2024 at 12:43
  • Based on your description Local build/publish those have 8.0., it seems that you can build your project successfully on your local machine. If so, have a try to set up a self-hosted agent on your local machine and run the pipeline using this agent. Then we can know whether the issue is related to your project or pipeline settings. Commented May 8, 2024 at 8:29

2 Answers 2

0

Excluding the frontend part of the pipeline, we succesfully build Umbraco 13 (and therefore .net 8) with this

pool:
  vmImage: 'windows-latest'
  demands:
  - msbuild
  - visualstudio
trigger:
  - main


variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages

steps:
- task: UseDotNet@2
  displayName: Setup .Net 8
  inputs:
    packageType: 'sdk'
    version: '8.0.x'

- task: DotNetCoreCLI@2
  displayName: Publish Solution
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

- task: PublishBuildArtifacts@1
  displayName: Publish Artifact
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'prod-drop'
    publishLocation: 'Container'
Sign up to request clarification or add additional context in comments.

1 Comment

BTW, despite showing YAML stuff here, I'm having to use the UI. Not sure if that affects it. I thought maybe the version '8.x' might be the issue and tried '8.0.x' but still no. I slimmed down the extras from the pipeline to just: (UseDotNet 8.0.x sdk, dotnet restore, npm install, npm build, dotnet publish, Publish Artifact) but still no luck. I have "publish web projects" checked on the publish step.
0

I was able to get a successful build/deployment after creating a new build pipeline from scratch.

  • dotnet restore
  • npm install
  • npm build
  • dotnet publish
  • Publish Artifact

For whatever reason, the old pipeline was holding on to something it shouldn't have (even Clean didn't help).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.