In my Jenkins build workflow I am using MSBuild to build project and then run publish profile to deploy files. General Setup below:
Build a Visual Studo project or solution using MSBuild
MSBuild Version:
MSBuild VS2017
MSBuild Build File:
ProjectName.csproj
Command Line Arguments:
/P:DeployOnBuild=True
/P:PublishProfile=profile-name
/P:Configuration=config-name
Issue I am running into is during the publishing process it is throwing, "The process cannot access the file ________ because it is being used by another process.":
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Web\Deploy\Microsoft.Web.Publishing.Deploy.FileSystem.targets(96,5): error : Copying file obj\jenkins-services-cms\Package\PackageTmp\bin\FileName.dll to \server\bin\FileName.dll failed. The process cannot access the file '\server\bin\FileName.dll' because it is being used by another process. [D:\jenkins\workspace\WorkspaceName\ProjectName.csproj]
Manually scheduling another build in Jenkins typically resolves the build error. Is there any way to apply permissions during the publishing process to avoid this issue?