小编spo*_*ser的帖子

在Windows 10中编译问题

我发现了与构建使用C:\ Windows\System32\CertEnroll.dll作为参考的应用程序相关的问题.

在Windows 7上使用VS 2015编译然后在Windows 7计算机上运行时,以下代码可以正常工作.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CERTENROLLLib;

namespace CertTest
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                CX509PrivateKey key = new CX509PrivateKey();
                key.ContainerName = Guid.NewGuid().ToString();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当您尝试在Windows 10中编译它,然后尝试在Windows 7计算机上运行它时,它会引发以下错误.

"无法将'System .__ ComObject'类型的COM对象强制转换为接口类型'CERTENROLLLib.CX509PrivateKey'.此操作失败,因为QueryInterface调用COM组件上的IID为'{728AB362-217D-11DA-B2A4-000E7BBB2B09}的接口'由于以下错误而失败:不支持此类接口(来自HRESULT的异常:0x80004002(E_NOINTERFACE))."

我有几个人在这里复制它,我想在联系微软之前得到更多的意见,了解这里发生了什么.

我想我的问题是:其他人可以证实这一点,或者是否确认他们违反了兼容性?

c# certenroll windows-10

16
推荐指数
2
解决办法
3006
查看次数

在 Azure 管道之间传递变量

我有一个场景,我需要在两个管道之间传递一个变量,并在目标管道上的编译时评估该变量。

我有一个构建管道,可以

  1. 构建所有服务
  2. 仅构建其中一项服务

由于 Azure Pipelines 的限制,构建管道需要保持独立于部署管道。触发器批处理功能当前不支持运行新构建,除非第一个构建已 100% 完成管道。我们有手动批准,所以这是不行的。

我有一个部署管道,理想情况下应该支持使用参数传递“AllServices”或用户想要部署的单个服务的名称来手动触发,并支持在自动构建期间由资源管道触发。

我正在努力解决的问题是部署管道如何获取在触发期间发送给它的信息,或者可以将其设置在编译时读取的地方?这些变量仅在运行时可用

resources.pipeline.<Alias>.projectName
resources.pipeline.<Alias>.projectID
resources.pipeline.<Alias>.pipelineName
resources.pipeline.<Alias>.pipelineID
resources.pipeline.<Alias>.runName
resources.pipeline.<Alias>.runID
resources.pipeline.<Alias>.runURI
resources.pipeline.<Alias>.sourceBranch
resources.pipeline.<Alias>.sourceCommit
resources.pipeline.<Alias>.sourceProvider
resources.pipeline.<Alias>.requestedFor
resources.pipeline.<Alias>.requestedForID
Run Code Online (Sandbox Code Playgroud)

编译时间与运行时在这里很重要,因为我使用 ${{ }}: 语法来控制将哪些参数注入到部署模板中。

resources:
  pipelines:
  - pipeline: services_build
    source: Services.Build
    trigger: true

name: Services-$(Date:yyyyMMdd).$(Rev:r)
trigger: none
pr: none

stages:
- template: ../templates/deploy_the_services.yaml
  parameters:
    ${{ if startsWith(resources.pipeline.services_build.pipelineName, 'AllServices') }}:
      services:
        - Service1
        - Service2
        - Service3
    ${{ if startsWith(resources.pipeline.services_build.pipelineName, 'Service1') }}:
      services:
        - Service1
Run Code Online (Sandbox Code Playgroud)

部署服务.yaml

parameters:
  - name: services
    type: object

stages:
  - stage: EnvironmentA
    displayName: …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines

5
推荐指数
1
解决办法
8628
查看次数