简体   繁体   中英

Jenkins MSBuild Process cannot access the file

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?

Jenkins MSBuild Process cannot access the file

According to the error message " The process cannot access the file '\\server\\bin\\FileName.dll' because it is being used by another process. ". It seems you do not have write permission to the folder server .

You can try to Set write permission by .wpp.targets file on the that folder, for details info, you can refer to the document: Setting Folder Permissions on Web Publish

If above not help you, please try to use Process Explorer to find out what is holding on that file/folder, and make sure you have close all Visual Studio instance, and you can try to kill the handle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM