Reputation: 467
I'm trying to set up CICD for my .NET Core application with GitLab CI.
Let's start with my .gitlab-ci.yml
image : microsoft/dotnet:latest
before_script:
- 'cd Backend'
- 'dotnet restore'
build:
stage: build
script:
- 'dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=Properties/PublishProfiles/WebioProfile.pubxml'
only:
- cicd_test
And WebioProfile
I'm using
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://xxx.hostingasp.pl/</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>03120c29-ae98-4c30-9b8c-7ec70f6642fd</ProjectGuid>
<MSDeployServiceURL>ssl3.xxxx.hostingasp.pl</MSDeployServiceURL>
<DeployIisAppPath>xxxx.hostingasp.pl</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>user</UserName>
<Password>password</Password>
</PropertyGroup>
</Project>
After git push origin cicd_test
I got this error GitLab Job console
Restore completed in 58.11 ms for /builds/username/project/Backend/Backend.csproj.
Backend -> /builds/username/project/Backend/bin/Release/netcoreapp2.1/Backend.dll Backend -> /builds/username/project/Backend/obj/Release/netcoreapp2.1/PubTmp/Out/ /usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(171,5): error MSB6004: The specified task executable location "%ProgramW6432%/IIS/Microsoft Web Deploy V3/msdeploy.exe" is invalid. [/builds/username/project/Backend/Backend.csproj]Build FAILED.
From what I see, %ProgramW6432%
is some kind of variable that isnt set? But where I can change it?
Worth to notice, deploying using same commands as in .gitlab-ci.yml
works fine if I run it localy from VS CLI
Upvotes: 5
Views: 2064
Reputation: 1
I got the same error when trying to publish to Azure app service from a Mac.
This issue helped me solve the problem: https://github.com/aspnet/websdk/issues/241
Instead of using the 'dotnet publish' command it can be done using msbuild:
msbuild project-name.csproj -c Release /p:DeployOnBuild=true /p:PublishProfile=publishprofile.pubxml
Upvotes: -2