Pack runs too often -- PackTask frequently fails with file access conflict #4289

Closed
AArnott opened this Issue Jan 15, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@AArnott
Contributor

AArnott commented Jan 15, 2017

Details about Problem

Visual Studio d15rel 26114.0

Detailed repro steps so we can see the same problem

Disable package restore in VS prior to completing these steps since VS can't restore these packages properly.

git clone https://github.com/Microsoft/vs-validation.git
cd vs-validation
git checkout acdf1788ab8ec42325f73e00dc350cf3001cf6d2
.\init
src\Microsoft.VisualStudio.Validation.sln

Right-click on the Microsoft.VisualStudio.Validation project and click Pack.
After a successful pack, execute the command again.

1>------ Build started: Project: Microsoft.VisualStudio.Validation, Configuration: Debug Any CPU ------
1>Microsoft.VisualStudio.Validation -> C:\git\validation\src\Microsoft.VisualStudio.Validation\bin\Debug\netstandard1.0\Microsoft.VisualStudio.Validation.dll
1>Microsoft.VisualStudio.Validation -> C:\git\validation\src\Microsoft.VisualStudio.Validation\bin\Debug\net45\Microsoft.VisualStudio.Validation.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: The "PackTask" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: System.IO.IOException: The process cannot access the file 'C:\git\validation\src\Microsoft.VisualStudio.Validation\bin\Debug\Microsoft.VisualStudio.Validation.1.0.0.nupkg' because it is being used by another process.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage(String path)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTaskLogic.BuildPackage(PackCommandRunner runner)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTask.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "Microsoft.VisualStudio.Validation.csproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jan 16, 2017

Contributor

@AArnott the project from the repository does not build , and as a result does not pack either.

however, i tried this with a simple class library project that targets net45 and netstandard1.3, and tried packing repeatedly from VS and i don't get a file access conflict. i am attaching a project against which i trid repro'ing this issue.

If this still repro's for you , could you use process explorer to figure out what process is using the nupkg?
ClassLibrary1.zip

Contributor

rohit21agrawal commented Jan 16, 2017

@AArnott the project from the repository does not build , and as a result does not pack either.

however, i tried this with a simple class library project that targets net45 and netstandard1.3, and tried packing repeatedly from VS and i don't get a file access conflict. i am attaching a project against which i trid repro'ing this issue.

If this still repro's for you , could you use process explorer to figure out what process is using the nupkg?
ClassLibrary1.zip

@rrelyea rrelyea modified the milestones: 4.0 RTM, 4.0 RC3 Jan 16, 2017

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott Jan 17, 2017

Contributor

I've updated the repro steps to clarify how to get the project to build.
Regarding what process is accessing the nupkg, is there any doubt that it's msbuild.exe? I certainly don't have any other processes that would be reading that file.

Contributor

AArnott commented Jan 17, 2017

I've updated the repro steps to clarify how to get the project to build.
Regarding what process is accessing the nupkg, is there any doubt that it's msbuild.exe? I certainly don't have any other processes that would be reading that file.

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jan 17, 2017

Contributor

@AArnott thanks, i can repro this now.. will update once i have a fix for this.

Contributor

rohit21agrawal commented Jan 17, 2017

@AArnott thanks, i can repro this now.. will update once i have a fix for this.

@AArnott AArnott referenced this issue in Microsoft/vs-validation Jan 21, 2017

Closed

.NET Core SDK adoption blockers #5

13 of 19 tasks complete
@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott Jan 23, 2017

Contributor

Hit this again while in e2e scenario test day, scenario 31 when I right-clicked on the netstandard lib project and selected Pack from within VS.

Contributor

AArnott commented Jan 23, 2017

Hit this again while in e2e scenario test day, scenario 31 when I right-clicked on the netstandard lib project and selected Pack from within VS.

@rrelyea rrelyea changed the title from PackTask frequently fails with file access conflict to Pack runs too often -- PackTask frequently fails with file access conflict Jan 24, 2017

@rrelyea

This comment has been minimized.

Show comment
Hide comment
@rrelyea

rrelyea Jan 25, 2017

Contributor

To improve search, believe this hit "being used by another process" in the error message.

Contributor

rrelyea commented Jan 25, 2017

To improve search, believe this hit "being used by another process" in the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment