-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Bundle-Migration errors with "cannot access file...being used by another process" #25555
Comments
Note from triage: consider removing. |
I'm seeing the same problem when running $ dotnet ef migrations bundle --verbose
Using project 'X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj'.
Using startup project 'X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj'.
Writing 'X:\Github\songbird\src\Songbird.Web\obj\Songbird.Web.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Karl\AppData\Local\Temp\tmp5143.tmp /verbosity:quiet /nologo X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj
Writing 'X:\Github\songbird\src\Songbird.Web\obj\Songbird.Web.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Karl\AppData\Local\Temp\tmp5309.tmp /verbosity:quiet /nologo X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj
Build started...
dotnet build X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj /verbosity:quiet /nologo
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.33
Build succeeded.
dotnet exec --depsfile X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.deps.json --additionalprobingpath C:\Users\Karl\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.runtimeconfig.json C:\Users\Karl\.nuget\packages\dotnet-ef\6.0.0-preview.7.21378.4\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll migrations bundle --assembly X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll --project X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj --startup-assembly X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll --startup-project X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj --project-dir X:\Github\songbird\src\Songbird.Web\ --root-namespace Songbird.Web --language C# --working-dir X:\Github\songbird\src\Songbird.Web --verbose
Using assembly 'Songbird.Web'.
Using startup assembly 'Songbird.Web'.
Using application base 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0'.
Using working directory 'X:\Github\songbird\src\Songbird.Web'.
Using root namespace 'Songbird.Web'.
Using project directory 'X:\Github\songbird\src\Songbird.Web\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider in assembly 'Songbird.Web'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
Using application service provider from Microsoft.Extensions.Hosting.
Found DbContext 'SongbirdContext'.
Finding DbContext classes in the project...
Using context 'SongbirdContext'.
Building bundle...
dotnet publish --output C:\Users\Karl\AppData\Local\Temp\pqtfcewu.r5o\publish
Microsoft (R) Build Engine version 17.0.0-preview-21378-03+d592862ed for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored C:\Users\Karl\AppData\Local\Temp\pqtfcewu.r5o\bundle.csproj (in 735 ms).
1 of 2 projects are up-to-date for restore.
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Beginning retry 10 in 1000ms. The process cannot
access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): error MSB3027: Could not copy "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". Exceeded retry count of 10. Failed. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Microsoft.Common.CurrentVersion.targets(4508,5): error MSB3021: Unable to copy file "obj\Debug\net6.0\Songbird.Web.dll" to "bin\Debug\net6.0\Songbird.Web.dll". The process cannot access the file 'X:\Github\songbird\src\Songbird.Web\bin\Debug\net6.0\Songbird.Web.dll' because it is being used by another process. [X:\Github\songbird\src\Songbird.Web\Songbird.Web.csproj]
Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use --verbose to see errors.
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsBundleCommand.Execute(String[] args) in ef.dll:token 0x60001a9+0x23b
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args) in ef.dll:token 0x6000205+0x3b
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) in ef.dll:token 0x6000053+0x100
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) in ef.dll:token 0x60000cf+0x2e
Build failed. Use --verbose to see errors. This is the project I'm trying to build a bundle for. Both building and publishing works fine. <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AutoMapper.Collection" Version="7.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="LetterAvatars.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.0-preview.7.21378.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-preview.7.21378.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-preview.7.21378.4" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="6.0.0-preview.7.21378.6" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.0-preview.7.21378.6" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.0-preview.7.21378.6" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.0-preview.7.21378.6" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.16.0" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="1.16.0" />
<PackageReference Include="NEST" Version="7.14.1" />
<PackageReference Include="NEST.JsonNetSerializer" Version="7.14.1" />
<PackageReference Include="RobotsTxtCore" Version="1.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
</ItemGroup>
</Project> |
This appears to be fixed on RC1 with latest version of Visual Studio. I wonder if OmniSharp just needs to catch up too... |
Seems like it is broken again with dotnet-ef |
gah ... I'm getting it now too (preparing for conference demo this week eek) VS Code on Windows using EF Core Version="6.0.0-rtm.21518.2 I have the same version of the tools. Dotnet version 6.0.100-rc.2.21505.57. "Punted for 6" as in not getting fixed?? |
I´m getting this error both with
Workaround: Below is the complete output log. I also uploaded the project to here if you would like to try it out.
|
Same ...I tried reverting to the earlier build with no luck. @bricelam mentioned that it's a problem with Omnisharp. (I can run the command from the visual studio command prompt ONLY IF VS CODE IS CLOSED...a little clunky for a conference demo but that's what I'll have to do). Is there an issue filed on the omnisharp end? Further experiments: |
15 minutes later. I closed and opened VS Code and tried again and ....SOB...it's back. sorry about that |
I am facing the same issue with I don't have VS Code is running and C# extension is disabled in VS Code. |
|
阿甘,你TM真是个天才 |
for me the errors appear when I add and configure Nerdbank.GitVersioning to the solution |
I was having this issue for an Azure Pipelines build using a self-hosted agent. Adding '--configuration Bundle' made the problem go away. |
I have encountered this issue and described it in #1261. I was investigating it a bit and I think it can be pretty quickly fixed (if there is no time for a "real" fix) by allowing us to pass the new dotnet build & publish property "--disable-build-servers". It is not the perfect fix, but it would cause the build step to close all the dotnet.exe processes it's starting when building the projects before the publish step happens. It would be a way to make it work for those who don't mind invalidating the build cache. |
Note for triage: we should consider the |
This was saddening news. I came here experiencing this issue in our CI build in Azure DevOps Pipelines, using v6.0.25. No time soon are we able to upgrade to 7 in order to work around this issue. Adding my vote for getting a fix backported to v6.0.x. |
It's not fixed in 7 (or 8) anyway. |
Yeah, I tested with the 7.0 version of That said, I did actually manage to get the 6.0.25 version to work in Azure DevOps Pipelines, which is great! I'm not 100% sure how, which is not so great :| This is my build command, and the main difference is that I use an absolute path to the project file, while previously it was relative to the current working folder.
Note also that I did not use the "--configuration Bundle" trick, as this did not help for me at all. |
Attempt to help with #25555. Note that this code is in `dotnet-ef`, so a new tool version is needed to get this change. Tested with locally built tool package and didn't see any issues.
Attempt to help with #25555. Note that this code is in `dotnet-ef`, so a new tool version is needed to get this change. Tested with locally built tool package and didn't see any issues.
@ajcvickers What is the status of this fix considering #32737 has been merged? Has that been released to the public yet? |
@jasekiw I'd be extremely surprised, but very happy, if #32737 fully fixed this. It will be included in 9.0 preview 1, but you should be able to try it now with the daily builds. |
#32737 Doesn't fix the issue for me. This is going to prevent us from upgrading our projects, which build fine in .Net 6, to .Net 8. |
@ChrisPeacock1 Are you using the daily tool build? |
Hey folks - we (SDK and Roslyn teams) very very very strongly recommend against using the We'd love to work with the EF team to help diagnose why these errors are seen during the bundle generation, as well as work towards a solution that doesn't use cc @jaredpar |
Yes, I am. |
what is the workaround for this until it is fixed in the very far feature? |
We followed the workaround here by adding
|
The workaround in the above didn't work for me, but what does work is removing the runtime (e.g.
The bundle does some extra file copying at the end where a Windows runtime is specified, and it's during this that the locked file cannot be moved. |
Originally reported by @ryanrichard19 in #19693 (comment)
For some reason,
dotnet publish
is behaving differently between Bundle-Migration anddotnet ef migrations bundle
.The text was updated successfully, but these errors were encountered: