github - 使用 GitHub Actions 构建安装程序

标签 github github-actions vdproj

是否可以使用 GitHub Actions 自动构建安装程序?这是一个 VSTO 加载项解决方案,包含多个 .NET 项目和一个“Visual Studio 安装程序项目”(又名 vdproj)。我需要在提交到特定分支时构建安装程序项目。

最佳答案

是的,这是可能的。

首先确保环境是Windows:

jobs:
    ....
    runs-on: windows-2022

要构建 VSTO 解决方案,您必须先导入 pfx 证书:

- name: Import certificate from the command-line
  shell: pwsh
  run: |
    $Secure_String_Pwd = ConvertTo-SecureString "<password>" -AsPlainText -Force
    Import-PfxCertificate -FilePath '${{github.workspace}}\<path>\project1_TemporaryKey.pfx' -CertStoreLocation Cert:\CurrentUser\My -Password $Secure_String_Pwd
    

然后使用 msbuild 构建 VSTO:

- name: setup-msbuild
  uses: microsoft/setup-msbuild@v1.1.3

- name: Set VS.net environment
  run: cmd.exe /C CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
- name: Build VSTO
  run: msbuild ${{github.workspace}}\yourproject.sln -t:rebuild /p:Platform="Any CPU" /p:Configuration="Release" /nologo /nr:false /p:VisualStudioVersion="17.0"

并构建 Visual Studio 安装程序项目:

- name: Setup VS Dev Environment
  uses: seanmiddleditch/gha-setup-vsdevenv@v4
- name: Build installer
  run: devenv.com ${{github.workspace}}\yourproject\yourproject.vdproj /build "Release|Any CPU"

关于github - 使用 GitHub Actions 构建安装程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71823928/

相关文章:

amazon-web-services - AWS codebuild - 在单个构建项目中与 Github 断开连接是否会从所有项目中删除

GNU screen 中的 Git 推送失败

javascript - ESLint 不会破坏 Github Actions 的构建

msbuild - 从 .vdproj 构建没有 Devenv 的合并模块

git - Pycharm,无法连接到私有(private)存储库

git - "Github for Windows"中的魔法是什么让它在 emacs 中工作?

postgresql - 如何解决 GitHub Actions 上 PostgreSQL 的 "permission denied for schema public"错误?

github-actions - 如何从 GitHub Actions(非自托管用例)+ FaSTLane 将 dSYM 从 Xcode 14 发送到 Firebase

c# - 如何制作没有可点击屏幕的 .msi 文件(全自动)?

visual-studio-2010 - 如何防止 .vdproj 编译在每次编译时更新 PackageCode?