Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The process cannot access the file because it is being used by another process #7020

Open
dgaszewski opened this issue Jun 13, 2018 · 12 comments
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Triage:NeedsMoreInfo

Comments

@dgaszewski
Copy link

NuGet version (4.6.0)

VS version: 15.7.3




I cannot create any NuGet packages anymore (even though that during the same day I did it a couple of times). I get an error that db.lock file is used by another process (which is VSs process ServiceHub.Host.CLR.x86). It doesn´t matter which project from the solution I want to use to create package. Neither removing the file or restarting VS/OS doesn´t help.


> PM> nuget pack <myprojectname>.nuspec -IncludeReferencedProjects
> Attempting to build package from '<myprojectname>.nuspec'.
> nuget : The process cannot access the file '<path_mysolutionname>\.vs\<mysolutionname>\v15\Server\sqlite3\db.lock' because it is being used by another process.
> At line:1 char:1
> + nuget pack <myprojectname>.nuspec -IncludeReferencedProjects
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : NotSpecified: (The process can...nother process.:String) [], RemoteException
>     + FullyQualifiedErrorId : NativeCommandError
@jainaashish
Copy link
Contributor

can you clean .vs folder and then try? (you can also try git clean -xdf if your solution is part of git)
Also, just curious why are you running nuget.exe inside visual studio? do you get the same error when you run it from outside command prompt?

@dgaszewski
Copy link
Author

Cleaning .vs doesn't help (and it is not a part of git). But running the command outside the VS works well, thanks! :)

@lanfeng
Copy link

lanfeng commented Jun 25, 2018

Met the same issues.
We use nuget.exe@4.6.2 to restore package for each project in the same solution.
It seems that the issues only happens in VSTS incredibuild. There is no issue when run msbuild even with /m parameter locally without incredibuild.

More detail:
+Solution directory

  • Project-A refer to P.nupkg, Q.nupkg, X.nupkg in packages.config
  • Project-B refer to Project A in .csproj and P.nupkg, Q.nupkg in packages.config
  • Project-C refer to Project A in .csproj and X.nupkg, Y.nupkg in packages.config
  • Project-D refer to Project C in .csproj and P.nupkg, X.nupkg in packages.config
  • Project-E refer to Project B, C and D in .csproj and P.nupkg, X.nupkg, Y.nupkg in packages.config

@chuanboz
Copy link

I meet the same issue by just upgrade Nuget.exe from v3.5 to v4.4+, and it seems the first restore is fine but then the 2nd restore will fail.

2>------ Build started: Project: Microsoft.OData.Edm.NetStandard.VS2017, Configuration: Debug Any CPU ------
1>Build started 10/18/2018 3:23:19 PM.
2>Build started 10/18/2018 3:23:19 PM.
1>Target RestoreNuGetPackages:
1> Restoring NuGet package StyleCop.MSBuild.4.7.49.
1> Adding package 'StyleCop.MSBuild.4.7.49' to folder 'E:\Github\odata.net\sln\packages'
1> Added package 'StyleCop.MSBuild.4.7.49' to folder 'E:\Github\odata.net\sln\packages'
1>
2>Target RestoreNuGetPackages:
2> Restoring NuGet package StyleCop.MSBuild.4.7.49.
1> NuGet Config files used:
1> E:\Github\odata.net\sln.nuget\NuGet.Config
1> C:\Users\chuanboz\AppData\Roaming\NuGet\NuGet.Config
1> C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
1> C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.config
1>
1> Feeds used:
1> C:\Users\chuanboz.nuget\packages
1> https://www.myget.org/F/odata/
1> https://api.nuget.org/v3/index.json
1> https://www.myget.org/F/dotnet-buildtools/
1> https://msazure.pkgs.visualstudio.com/_packaging/Intune_External/nuget/v3/index.json
1> https://msazure.pkgs.visualstudio.com/_packaging/Intune_Dev/nuget/v3/index.json
1> C:\Program Files (x86)\Microsoft SDKs\NuGetPackages
1> C:\Program Files\Microsoft SDKs\Service Fabric\packages
1>
1> Installed:
1> 1 package(s) to packages.config projects
1>Target GenerateAssemblyAttributeFile:
1> Skipping target "GenerateAssemblyAttributeFile" because all output files are up-to-date with respect to the input files.
2> Adding package 'StyleCop.MSBuild.4.7.49' to folder 'E:\Github\odata.net\sln\packages'
2> Added package 'StyleCop.MSBuild.4.7.49' to folder 'E:\Github\odata.net\sln\packages'
...
6>------ Build started: Project: Microsoft.OData.Edm.Tests.NetCore, Configuration: Debug Any CPU ------
5>Build started 10/18/2018 3:23:24 PM.
5>Target _GetProjectReferenceTargetFrameworkProperties:
4>Build started 10/18/2018 3:23:24 PM.
6>Build started 10/18/2018 3:23:24 PM.
6>Target _GetProjectReferenceTargetFrameworkProperties:
4>Target RestoreNuGetPackages:
4> Restoring NuGet package StyleCop.MSBuild.4.7.49.
4> Adding package 'StyleCop.MSBuild.4.7.49' to folder 'E:\Github\odata.net\sln\packages'
4> EXEC : warning : The process cannot access the file 'E:\Github\odata.net\sln\packages\StyleCop.MSBuild.4.7.49.0\tools\mssp7en.dll' because it is being used by another process.
4>

@Stoobs
Copy link

Stoobs commented Nov 2, 2018

I'm getting the same errror on our build server after updating the nuget version on the build agents:

2018-11-02T11:02:33.0809500Z     The process cannot access the file 'N:\2015 Build Agents\F\_work\59\s\packages\Castle.Core.4.3.1\lib\netstandard1.3\Castle.Core.dll' because it is being used by another process.

2018-11-02T11:02:33.0809500Z     The process cannot access the file 'N:\2015 Build Agents\F\_work\59\s\packages\Moq.4.10.0\lib\netstandard1.3\Moq.dll' because it is being used by another process.

2018-11-02T11:02:33.0965500Z     The process cannot access the file 'N:\2015 Build Agents\F\_work\59\s\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll' because it is being used by another process.

Any progress on this issue at all?

Is there something I can do other than reverting the nuget versions?

@jainaashish
Copy link
Contributor

jainaashish commented Nov 2, 2018

Does it repro with latest NuGet.exe 4.8.1 (https://dist.nuget.org/win-x86-commandline/v4.8.1/nuget.exe)? If yes, then can someone provide simple repro steps for the issue?

@Stoobs
Copy link

Stoobs commented Nov 2, 2018

I'm not in the office at the moment, but this behaviour was seen after performing a self update on nuget yesterday, so I presume that it was the latest.

I stopped the issue by reverting to the previous version as it was preventing any builds from running on the server.

@genscape-agodfrey
Copy link

genscape-agodfrey commented Feb 15, 2019

I am seeing this issue with our teamcity build server with nuget 4.9.1

@kevison
Copy link

kevison commented Feb 19, 2019

I am seeing this issue with out team city build server as well. Nuget v. 4.9.2.5706. Any info about when this might get resolved?

@ghost ghost added the Status:Inactive Icebox issues not updated for a specific long time label Sep 1, 2022
@jwfx
Copy link

jwfx commented Feb 9, 2023

Is there any new information on this issue?

I'm currently contemplating running a second TeamCity agent on the same machine to use our resources a bit more efficiently. Last time we attempted that though, NuGet restoring blew up royally in our faces and we haven't tried this ever since.

@pronoyc11
Copy link

i am having this issure in my project terminal,i just wrote git log --onelog in hurry,i know it was a wrong command,after this i faced that issue,it's allways saying the same thing
Screenshot (12)

@jeffkl jeffkl added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. and removed Pipeline:Icebox labels Apr 3, 2024
@bamboat3
Copy link

NuGet version (4.6.0) VS version: 15.7.3 I cannot create any NuGet packages anymore (even though that during the same day I did it a couple of times). I get an error that db.lock file is used by another process (which is VSs process ServiceHub.Host.CLR.x86). It doesn´t matter which project from the solution I want to use to create package. Neither removing the file or restarting VS/OS doesn´t help.

> PM> nuget pack <myprojectname>.nuspec -IncludeReferencedProjects
> Attempting to build package from '<myprojectname>.nuspec'.
> nuget : The process cannot access the file '<path_mysolutionname>\.vs\<mysolutionname>\v15\Server\sqlite3\db.lock' because it is being used by another process.
> At line:1 char:1
> + nuget pack <myprojectname>.nuspec -IncludeReferencedProjects
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : NotSpecified: (The process can...nother process.:String) [], RemoteException
>     + FullyQualifiedErrorId : NativeCommandError

The easiest way close the VS Studio and delete the .vs folder from the project, then open the project again; the publishing problem will be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Triage:NeedsMoreInfo
Projects
None yet
Development

No branches or pull requests