rah*_*ahu 1 azure azure-devops azure-pipelines
我使用 .NET 桌面模板和“create .msi”扩展名创建了一个管道,但它显示了一个警告:
##[warning]No .MSI files were found, please check your build-configuration. If this is expected, you might consider to use the default Visual Studio Build task instead of this custom Installer task.
2018-11-28T22:58:54.1434410Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何使用 Azure Pipeline 创建 exe 文件并将其部署在虚拟机上。
如果您使用.NET Core CLI 任务来构建您的控制台应用程序。
在 dotnet 发布参数命令下面会生成 .exe 文件。有关更多信息,请参阅此线程。
dotnet publish -r win-x64 -p:PublishSingleFile=True --self-contained false
因此,您可以将上述参数添加到您的 .NET Core CLI 任务中。请参阅下面的 yaml 管道。
- task: DotNetCoreCLI@2
inputs:
command: publish
arguments: -r win-x64 -p:PublishSingleFile=True --self-contained false -o $(Build.ArtifactStagingDirectory)
projects: '**/*.csproj'
publishWebProjects: false
enabled: true
Run Code Online (Sandbox Code Playgroud)
以上 DotNetCoreCLI 任务会将 .exe 文件输出到文件夹$(Build.ArtifactStagingDirectory)(即。C:\agent\_work\1\a)
如果您使用Visual Studio Build 任务来构建您的控制台应用程序。
您可以先将下面的<PublishSingleFile>和<RuntimeIdentifier> 属性添加到项目的 .csproj 文件中。
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishSingleFile>True</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
然后在您的管道中设置Visual Studio Build 任务的msbuildArgs,如下所示:
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/t:publish /p:PublishSingleFile=True /p:RuntimeIdentifier=win-x64 /p:outputpath=$(Build.ArtifactStagingDirectory)\'
Run Code Online (Sandbox Code Playgroud)
然后 Vsbuild 任务会将 .exe 文件输出到(即)中$(Build.ArtifactStagingDirectory)指定的文件夹中/p:outputpathC:\agent\_work\1\a
| 归档时间: |
|
| 查看次数: |
4256 次 |
| 最近记录: |