admin管理员组

文章数量:1124691

I have been assigned a task to create a build pipeline for a dotnet framework 4.8 project. Although I have tried few steps, I am running out of luck.

My aim is to be able to form a gitlab pipeline which can build dotnet 4.8 project. I want to use a docker image to perform this task. Or is there any other way to do this? I would really appreciate if someone could provide the steps along with for the gitlab yaml pipeline.

Steps I have followed till now :-
1. Created a gitlab runner and registered it in the server. The gitlab runner is added to the config.toml file as a shell executor.

2.Created a yaml pipeline file in the gitlab repo. Here is what the yaml file looks like so far.

image: mcr.microsoft/dotnet/framework/sdk:4.8

# Local variable used in this pipeline
variables:
    PUBLISH_PATH: ${CI_PROJECT_DIR}/publish
    
#Condition to run pipeline
.run-pipeline: &run-pipeline
  rules:
    - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "master")


# The sequential stages of this pipeline.# Jobs within a stage run in parallel.# .html#stages
stages:
  - build
  - deploy

 # Build .Net Code 
build:
  stage: build
  script:
   - dotnet clean ApplicationSoultion.sln -c Release
   - dotnet restore ApplicationSoultion.sln
   - dotnet build ApplicationSoultion.sln -c Release
  tags:
    - qwiz

# Create release for Test environment and configure settings. 
create-test-release:
  stage: deploy
  #<<: *run-pipeline
  needs:
    - job: build
  dependencies:
    - build
  script:
    - dotnet publish ApplicationSoultion.sln -c Release -o publish
    - *download-webconfig
    - *download-frontend-code
    - *download-configuration
  tags:
    - qwiz
  artifacts:
    paths:
      - '$PUBLISH_PATH'
    name: 'QWIZ.Test.${CI_PIPELINE_ID}'
    expire_in: 1 week
  environment:
    name: Test
    url: url

# Deploy the code in Test environment.
deploy-test:
  stage: deploy
  #<<: *run-pipeline
  needs:
    - job: create-test-release
      artifacts: true
  dependencies:
    - create-test-release
  script:
    - *stop-apppool
    #- *deploy-code-to-server
    - *start-apppool
  tags:
    - qwiz
  environment:
    name: Test
    url: url

I have excluded most of the code for stage deploy for keep this question short. After I run this code, build is successful but once I deploy and run the application I am getting an error like this .

An error occurred while starting the application.
.NET Framework 4.8.4749.0 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687    |    Microsoft Windows 10.0.14393

Can anyone tell me how do I need to modify the yaml or what additional steps to be followed. My hunch would be the image is not able to build the dotnet4.8 project properly

Thanks in advance

本文标签: netHow to build a dotnet framework 48 project in GitlabStack Overflow