无法在gitlab中使用pubxml文件部署dotnet核心应用

时间:2020-01-21 23:54:48

标签: c# .net-core gitlab

我正在尝试使用.pubxml配置文件,以便使用gitlab作业运行程序在gitlab中部署我的应用。

这是我的yml文件

image: mcr.microsoft.com/dotnet/core/sdk:3.0

stages:
    - deploy

variables:
    test: "Tests/UnitTests/FeatureSwitch.UnitTests"

before_script:
    - "dotnet restore"

deploy:
    stage: deploy
    script: 
        - "cd FeatureSwitch"
        - 'dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=Properties/PublishProfiles/Development.pubxml'

这是我的个人资料:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <ProjectGuid>...</ProjectGuid>
    <SelfContained>false</SelfContained>
    <MSDeployServiceURL>https://...</MSDeployServiceURL>
    <DeployIisAppPath>...</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>...</UserName>
    <_SavePWD>True</_SavePWD>
  </PropertyGroup>
</Project>

Development.pubxml.user文件也看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TimeStampOfAssociatedLegacyPublishXmlFile />
    <EncryptedPassword>...</EncryptedPassword>
  </PropertyGroup>
</Project>

配置文件是从VS自动生成的,如果我单击从VS发布,则可以正常工作。

但是如果我从gitlab运行它,它将无法正常工作。

错误如下所示:

建立失败。 /usr/share/dotnet/sdk/3.0.102/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(171,5):错误MSB6004:指定的任务可执行位置“%ProgramW6432%/ IIS / Microsoft Web Deploy V3 / msdeploy.exe”无效。 [/builds/rajmond.burgaj/featureswitch/FeatureSwitch/FeatureSwitch.csproj] 0警告 1个错误 经过的时间00:00:08.21 错误:作业失败:退出代码1

搜索后,我只发现了一个类似的问题here,没有任何答案!

有人知道这可能是什么问题吗?

这与gitlab本身有关还是命令有问题?

0 个答案:

没有答案