小编Krz*_*tof的帖子

从 C# 应用程序中的配置文件中检索值不起作用

我遇到了一个问题,当我尝试使用配置文件时,我在这里和其他地方阅读了一些帖子,但我无法解决工作中的问题,

在我的问题中,我添加了配置。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="CA.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <userSettings>
        <CA.Properties.Settings>
 
          <appSettings>
            <add key="ab123" value="D:\ab123\Source\ab123.c" />
          </appSettings>

        </CA.Properties.Settings>
    </userSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

文件中声明

string ab123 = ConfigurationManager.AppSettings["ab123"];
Run Code Online (Sandbox Code Playgroud)

但是在侧面,我显示的错误是“win32 Exception was unhandled - System can not find the file specified”

System.Diagnostics.Process.Start(ConfigurationManager.AppSettings["ab123"]);
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,ab123值始终为空!我确定路径是正常的。

我该如何解决?

c# config

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

具有来自同一分支的多个工件的 Azure DevOps 版本

我们有两个构建管道从同一个存储库中的两个不同路径构建。

BuildPipelineA建立/ PathAAppRepo并公布神器ArtifactA

BuildPipelineB建立/ PathBAppRepo并公布神器ArtifactB

然后我们有一个发布管道,它使用这两个工件将应用程序部署到一些 WebApp。

作为分支策略,我们使用自定义 Gitflow 工作流。唯一的区别是我们有两个开发团队,每个团队都有自己的集成分支。所以基本上develop我们没有经典分支,而是有develop,develop-teamAlphadevelop-teamBeta。除了master,release/和之外,触发器设置为所有三个分支,hotfix/因此总共有六个分支是目标。

我想要实现的是建立一个 CI/CD 流程,该流程将始终从匹配(相同)分支中获取工件以进行自动触发的发布创建。

例如,假设存在先前的masterArtifactB

  • 开发人员master/PathA 中的某些文件提交更改

  • BuildPipelineA触发器和构建ArtifactAmaster

  • ReleasePipeline现在应该创建一个使用新版本masterArtifactAmasterArtifactB

即使触发工件来自不同的分支,我也希望发生同样的事情:

  • 开发人员develop/PathB 中的某些文件提交更改

  • BuildPipelineB触发器和构建ArtifactBdevelop

  • ReleasePipeline现在应该创建一个使用新版本developArtifactB和(现有) …

azure-devops

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

将 bash 命令输出设置为 azure yml 变量

我正在使用 Azure DevOps,我需要将 bash 命令的返回设置为一些变量,例如我有以下内容:

    variables:
      VERSION: 7.2 # works fine
      FILE_VERSION: ${{cat public/VERSION}} # syntax error
Run Code Online (Sandbox Code Playgroud)

我尝试了一些${{}}没有成功的变体,并且找不到正确的语法,但我认为它一定是可能的。

yaml azure-devops azure-pipelines

5
推荐指数
2
解决办法
9143
查看次数

使用特定节点版本通过 Azure 部署静态 Web 应用程序

我正在尝试使用 Azure 服务和 Github Actions 来部署静态 Web 应用程序。

问题是,我需要使用 NodeJS 运行脚本。我正在使用 ESM 模块,这些模块在 Node v14 中运行良好。问题是,在构建任务期间,Azure(或github)使用v12.8(我猜是LTS),其中不支持ESM模块。

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - master
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - master

jobs:
  build_and_deploy_job:

    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')

    runs-on: ubuntu-latest

    name: Build and Deploy Job

    steps:

      - uses: actions/checkout@v2
        with:
          submodules: true

      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v0.0.1-preview
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_LEMON_GLACIER_0C510BD03 }}
          repo_token: ${{ …
Run Code Online (Sandbox Code Playgroud)

azure node.js github-actions

5
推荐指数
2
解决办法
2073
查看次数

Azure Devops YAML 管道 - 如何重复任务

在我的 YAML 管道中,我有一个部署工作:

- stage: deployment_to_development
  jobs:
  - deployment: deployment_to_development
    displayName: Deploy to Development
    environment: Development
    variables:
    - template: migrate-vars.yml
    strategy:
      runOnce:
        deploy:
          steps:
          - template: migrate-data.yml
Run Code Online (Sandbox Code Playgroud)

部署模板是一个简单的 DbUp 任务:

steps:
  - task: UpdateDatabaseWithDbUp@2
    displayName: Migrate data
    inputs:
      ConnectionString: 'Data Source=$(DatabaseServer);Initial Catalog=$(DatabaseName);Integrated Security=SSPI'
      ScriptPath: '$(Pipeline.Workspace)\data-migrations'
      JournalSchemaName: dbo
      JournalTableName: _SchemaVersions
      LogScriptOutput: true
      IncludeSubfolders: true
      Order: FolderStructure
      TransactionStrategy: SingleTransaction
Run Code Online (Sandbox Code Playgroud)

变量模板定义了服务器和数据库名称:

variables:
   DatabaseServer: 'server'
   DatabaseName: 'dbName'
   Instances: '_1,_2'
Run Code Online (Sandbox Code Playgroud)

对于单个数据库,这一切都很好。但是,我希望为 Instances 变量中定义的每个实例重复该任务,即对于名为 dbName_1、dbName_2 的数据库。这个看似简单的壮举被证明是困难的。

我尝试将实例作为参数数组传递并使用

parameters:
  param: []

steps:
  - ${{each p in parameters.param}}: …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines azure-devops-yaml

4
推荐指数
1
解决办法
1788
查看次数

如何使用 Axios (VueJS, Nuxt) 制作 .post

我是网络开发的新手。我想问一下如何.post用Axios用Nuxt创建一个。

我所需要的只是一个向 NodeJS 应用程序发送三个输入的按钮。

<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-body">
                        <form @submit="formSubmit">
                        <strong>Name:</strong>
                        <input type="text" class="form-control" v-model="name">
                        <strong>Email:</strong>
                        <input type="text" class="form-control" v-model="email">
                        <strong>Password:</strong>
                        <input type="text" class="form-control" v-model="password">
                        <button class="btn btn-success">Submit</button>
                  </div>
            </div>
        </div>
    </div>
</template>

<script>
  export default {
    data() {
       return {
         name: '',
         email: '',
         password: ''
       };
    },

    methods: {
       //Would like to use the button to do this:
      async sendData () {
        await this.$axios.get('insert', {
          name: this.name, 
          email: …
Run Code Online (Sandbox Code Playgroud)

vue.js axios nuxt.js

4
推荐指数
1
解决办法
2449
查看次数

发布管道 Azure Devops 代码覆盖率报告

我正在尝试在我的 Azure DevOps Pipeline 中在线发布详细报告,但我得到的只是一个下载此 Coverage 文件的链接。(自 Visual Studio 2019 以来,社区版本无法再读取该内容) 在此处输入图片说明

这是我的管道:

trigger:
  branches:
    include:
    - '*'

pool:
  vmImage: 'windows-2019'

steps:
- task: NuGetToolInstaller@0
  displayName: Instal Nuget
  inputs:
    checkLatest: true

- task: NuGetCommand@2
  displayName: Restore Nuget Packages
  inputs:
    restoreSolution: '**/*.sln'

- task: UseDotNet@2
  displayName: 'Install .NET Core SDK'
  inputs:
    version: 3.1.x
    performMultiLevelLookup: true

- task: DotNetCoreCLI@2
  displayName: Build Tests
  inputs:
    command: 'build'
    projects: '**/OneTienditaUnitTests/*.csproj'
    arguments: '--configuration Release'

- script: dotnet test OneTienditaUnitTests --logger trx --collect "Code coverage"

- task: PublishTestResults@2 …
Run Code Online (Sandbox Code Playgroud)

pipeline code-coverage cobertura azure-devops azure-pipelines

4
推荐指数
1
解决办法
2038
查看次数

检查/了解 Azure Devops 中的构建是否由手动或 CI 触发的最佳方法

我有 2 个存储库,source对于target源代码,发布管道中有 2 个阶段。一个是构建调用的工件Dev,另一个是trigger=> 使用 api 调用触发存储库的构建管道target。两个存储库都在同一个项目中。

可以target repo手动运行,无需连续 CI source-repo。现在我的问题是有没有可能弄清楚target-repo它是如何启动manuallyCI

阿兹多管道

azure azure-devops azure-pipelines

4
推荐指数
1
解决办法
3134
查看次数

Azure 管道。从资源库运行脚本

我在存储库中有 azure pipline 的 yaml 文件。我需要从不同的存储库运行 powershell 脚本。

据我了解,我可以将 side repo 添加到resourcesyaml 中的部分,然后与参数task:ShellScript@2一起使用scriptPath。但据我了解,它对于放置 yaml 的存储库相对有效。而且我不确定如何从不同的存储库访问文件。

azure devops azure-devops azure-pipelines

4
推荐指数
1
解决办法
5475
查看次数

Azure Pipelines:多行参数

在天蓝色管道中是否可以传递多行参数?如果type是 a string,你甚至不能用换行符编写。另一方面,如果typeis object,您可以输入多行,但变量中的所有 EOL 将被删除。

parameters:
- name: Multiline
  type: object
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如果我将参数保存到文本文件,结果是一行

- bash: |
    echo ${{ parameters.Multiline }} >> script.txt
    cat script.txt
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

parameters pipeline multiline azure-devops azure-pipelines

4
推荐指数
1
解决办法
7595
查看次数