首页 > 解决方案 > 为 ASP.NET 项目设置 CircleCI

问题描述

我正在使用 CircleCI 为我的 ASP.NET 项目设置 CI/CD 管道。

CircleCI 已经支持 Window Machine。所以我认为可以将 CircleCI 用于 ASP.NET 项目。通过遵循 CircleCI 的文档,我可以配置.NET Core项目(因为我可以使用命令行来构建和运行exe.NET Core 项目的文件)

version: 2.1

orbs:
  win: circleci/windows@1.0.0

jobs:
  build:
    executor:
      name: win/vs2019
      shell: powershell.exe
    steps:
      - checkout
      - restore_cache:
          keys:
            - dotnet-packages-v1-{{ checksum "circleci-demo-windows.csproj" }}
      - run:
          name: "Install project dependencies"
          command: dotnet.exe restore
      - save_cache:
          paths:
            - C:\Users\circleci\.nuget\packages
          key: dotnet-packages-v1-{{ checksum "circleci-demo-windows.csproj" }}

      - run:
          name: "Run Build step"
          command: dotnet.exe publish -c Release -r win10-x64
      - run:
          name: "Test the executable"
          command: .\bin\Release\netcoreapp2.1\win10-x64\publish\circleci-demo-windows.exe
      - store_artifacts:
          path: .\bin\Release\netcoreapp2.1\win10-x64\publish\circleci-demo-windows.exe

但似乎我不能使用dotnet.exe publish....NET 框架等命令。那么如何为 ASP.NET 设置 CircleCi 呢?

对不起我的天真问题,我四处搜索但找不到任何关于 CircleCI 和 .net 框架的教程。

标签: asp.net.netcontinuous-integrationcircleci

解决方案


dotnet.exe或可以简称为dotnet)命令对 .NET Core 相关项目有效。它根本不能用于 .NET Framework 项目。

如果要发布 .NET Framework 项目,则应使用或运行 MSBUILD 而不是 run dotnet。CircleCI 文档在某种程度上并不完整,因为它给您的印象是您可以使用它dotnet来发布 .NET Framework 项目,但实际上不能。


推荐阅读