your localdb has the HoaDB.mdf mounted, so you can not copy it. you must unmount the database depending on which sql server database support you are using.
The process cannot access the file 'App_Data\HoaDB.mdf' because it is being used by another process.
Hello,
I need some help, I am trying to publish an ASP.net application that uses SQL tables, and every time I try to publish I got the message
Transformed web.config using C:\Users\Jose Puga\Documents\Visual Studio 2019\Projects\HOATIM\HOATIM\Web.Release.config into obj\Release\TransformWebConfig\transformed\web.config.
Adding database (C:\Users\Jose Puga\Documents\Visual Studio 2019\Projects\HOATIM\HOATIM\obj\Release\AutoScripts\ConnectionString-Deployment_SchemaAndData.sql)
Adding database (MSDeploy.dbFullSql/dbFullSql[@mutia keyza ='C:\Users\Jose Puga\Documents\Visual Studio 2019\Projects\HOATIM\HOATIM\obj\Release\AutoScripts\ConnectionString-Deployment_SchemaAndData.sql']/sqlScript)
Adding database (C:\Users\Jose Puga\Documents\Visual Studio 2019\Projects\HOATIM\HOATIM\obj\Release\AutoScripts\SysDBS-Deployment_SchemaAndData.sql)
Adding database (MSDeploy.dbFullSql/dbFullSql[@mutia keyza ='C:\Users\Jose Puga\Documents\Visual Studio 2019\Projects\HOATIM\HOATIM\obj\Release\AutoScripts\SysDBS-Deployment_SchemaAndData.sql']/sqlScript)
Auto ConnectionString Transformed obj\Release\TransformWebConfig\transformed\web.config into obj\Release\CSAutoParameterize\transformed\web.config.
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.targets(2601,5): Error : Copying file App_Data\HoaDB.mdf to obj\Release\Package\PackageTmp\App_Data\HoaDB.mdf failed. The process cannot access the file 'App_Data\HoaDB.mdf' because it is being used by another process.
The process cannot access the file 'App_Data\HoaDB.mdf' because it is being used by another process.
Any help will be appreciated.
Thanks..
Developer technologies | ASP.NET | Other
SQL Server | Other
2 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2022-05-13T21:34:06.02+00:00 -
Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
2022-05-16T02:42:16.973+00:00 Hi @Jose Puga ,
You can try closing the Sql Server process running the mdf file using task manager.
Then close and reopen Visual Studio, copy the mdf file to the desired location.Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.