zoukankan      html  css  js  c++  java
  • # Azure DevOps 踩坑

    让.netCore 2.0 的测试在 Azure DevOps 中正确运行需要注意几个地方

    1. 要增加.netCore 的测试程序集目录;
      img
    2. 设置 Speceific location:C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEExtensionsTestPlatform 设置 Other console options:/Framework:".NETCoreApp,Version=v2.0"
      img
    3. 默认配置会包含 xunit(我是使用的 xunit)的测试程序集,这个是不需要的,会导致测试过程报错,需要将其排除。
      img

    将程序集打包发布到 Nuget 并支持远程调试

    • 程序集的项目文件需要加入打包相关配置:
       <!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
       <PublishRepositoryUrl>true</PublishRepositoryUrl>
       <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
       <EmbedUntrackedSources>false</EmbedUntrackedSources>
       <!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
       <IncludeSymbols>true</IncludeSymbols>
       <SymbolPackageFormat>snupkg</SymbolPackageFormat>
       <PackageLicenseExpression>MIT</PackageLicenseExpression>
    

    特别是License节点,在本地 push 的时候不会出问题,在 Azure DevOps 环境下 Push 没有这个会出问题,不能够远程调试。

    • 引入SourceLink程序集,下面是以代码提交到 GitHub 为例:
    <ItemGroup>
       <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
    </ItemGroup>
    

    其他平台对应的 lib 可参考 https://github.com/dotnet/sourcelink

    • 然后将程序集 push 到 nuget.org 时也会同时将snupkg文件 push 到符号服务器

    • 要使用远程调试需要对 Visual Studio 做一些配置
      img
      img

  • 相关阅读:
    只会写“Hello World”的菜鸟心声
    新的旅程
    生成[1,2,,3,4,5,6,7,8,9]的随机数组?
    计算java集合中自定义对象出现的次数
    iOS https 证书信任漏洞解决办法
    自定义 URL Scheme 完全指南
    Apple移动设备处理器指令集 armv6、armv7、armv7s及arm64
    url schemes格式错误
    给UITapGestureRecognizer添加tag
    iOS GIF 格式动画 图片显示
  • 原文地址:https://www.cnblogs.com/qinjin/p/AzureDevOps-Trap.html
Copyright © 2011-2022 走看看