Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Unable to create Release Build because .dll is being used by another process.

My project works fine in DEBUG.
But for some reason, when trying to make a release build, always get the following error:

Severity    Code    Description Project File    Line    Suppression State
Error       The process cannot access the file 'D:\Albertoha94\Documents\Visual Studio 2019\Fighter-MoveList\Fighter-MoveList.Android\obj\Release\100\androidx\cecil\Fighter-MoveList.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   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)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.AndroidX.Migration.CecilMigrator.ReadAssembly(AssemblyResolver resolver, String path)
   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(String source, String destination)
   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(IEnumerable`1 assemblies)
   at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute()  Fighter-MoveList.Android    D:\Albertoha94\_nugets\packages\xamarin.androidx.migration\1.0.0.1\buildTransitive\monoandroid90\Xamarin.AndroidX.Migration.targets 227 

I don't know if this is related in some way to AndroidX since i migrated my app to that but when doing a rollback I still got the issue and it still says androidx in the folder.
I tried what it was suggested in github to reduces the number of parallel project build to 1 but still no success, I also tried deleting all bin, obj & .suo but error still pops.

Is there something else I could try?

Best Answer

  • albertoha94albertoha94 Member ✭✭✭
    Accepted Answer

    So I was somewhat able to solve it.
    In the linker properties I changed the value from "SDK assemblies" to "None" and that did the trick.
    I know its preferably to have "SDK assemblies" on release but I just couldn't get it to work in other way.
    Should this be reported as a bug of some sort?

Answers

  • Do you have multiple IDE's open?

    How about you restart Visual Studio (maybe even your computer). That might fix it.

  • jezhjezh Member, Xamarin Team Xamurai

    I encounted such question before.
    Yes, you can try to restart your visual studio, if this problem persists, try to restart your computer just as EmmanuelOluwagbemiga said.

  • albertoha94albertoha94 Member ✭✭✭

    Thank you for your responses!
    @EmmanuelOluwagbemiga No, I am only running one instance of Visual Studio.
    @jezh I turned off and on the computer but the issue persisted :(

  • albertoha94albertoha94 Member ✭✭✭

    I tried restarting too and issue still happens :/

  • Sad that none of these worked for you. I hope you find a workaround before it gets fixed.

  • albertoha94albertoha94 Member ✭✭✭
    Accepted Answer

    So I was somewhat able to solve it.
    In the linker properties I changed the value from "SDK assemblies" to "None" and that did the trick.
    I know its preferably to have "SDK assemblies" on release but I just couldn't get it to work in other way.
    Should this be reported as a bug of some sort?

Sign In or Register to comment.