Reputation: 575
I have an ASP.Net application. I want to deploy to the remote Windows machine. I have a shared wwwroot
folder. To deploy from cmd
use the following command
c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" "C:\path_to_project" /p:SolutionDir="path_to_solution_dir" /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile="Profile.pubxml"
The profile looks the following way
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>\\<ip_address>\wwwroot</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
From command line it work fine. But when I put the same thing into Jenkins pipeline script using Batch plugin, I get the next error
error MSB3191: Unable to create directory "\\<ip_address>\wwwroot".
Could not find a part of the path '\\<ip_address>\wwwroot'
What's wrong with Jenkins? Are there any problems with configuration settings? Maybe I need to change the approach for deployment?
Upvotes: 4
Views: 3641
Reputation: 692
Try and switch <publishUrl>\\<ip_address>\wwwroot</publishUrl>
to your directory.
Upvotes: 0
Reputation: 361
check the value of the parameter is getting resolved. Also check the account with which Jenkins is running has privilege to the shared folder. We too have similar requirement, considering the network dependency and limit on parallel execution we installed agents in the respective boxes and we do local deployments using the Jenkins slave
Upvotes: 1
Reputation: 3651
Solved exactly for this approach back in 2015/16.
This was my setup:
I did 5 so I could pass parameters from a Jenkins Windows Batch step (this was a freestyle job before I fully migrated to pipeline in current role which started in Jan 2018) to two DOS batch script I wrote to
a) Remotely control target IIS (start/stop sites and AppPools)
b) Remotely delete the current contents of site before MSBuild redeployed via Publish Profile and the MSBuild /p:DeployOnBuild
.
I utilitised PSExec to achieve the "remote" capability and called it as part of the DOS batch scripts.
I'm sure you could achieve the same thing with Powershell but the principles are the same.
Upvotes: 2