I have a Xamarin Android project that I am trying to use Sdk and User Assembly linking with.
If I set the Android project to Sdk Assembly Linking only, the APK is created and deployed successfully and works.
However, when I set Sdk and User Assembly linking, with no other changes, I get the following error only when I deploy. The solution builds succesfully.
The "LinkAssemblies" task failed unexpectedly. System.IO.IOException: The process cannot access the file '<path-to-project>\AppName\AppName.Android\obj\Release\android\assets\AppName.Core.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.Write(String fileName, WriterParameters parameters) at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory) at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.BaseStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
AppName.Core.dll
is another library project in my solution that is set to build as NetStandard 2.0.
I have looked through many other bug reports and forum posts regarding a similar issue to this, but most seem related to an earlier bug with Visual Studio 15.5.1 that has since been fixed.
- The main Xamarin bug report is: https://bugzilla.xamarin.com/show_bug.cgi?id=56275 but was resolved in VS 15.2.
- A forum topic (https://forums.xamarin.com/discussion/32976/updating-xamarin-broke-the-build-process-the-process-cannot-access-the-file-appname-dll-mdb) also talks about a similar issue being resolved in VS 15.5.1.
- Other SO questions refer to older Xamarin or VS versions, or have unacceptable solutions (such as just turning off linking):
Regardless, I have tried just about every solution suggested in those links including:
- closing and reopening Visual Studio
- deleting /bin and /obj folders
- opening Visual Studio as Administrator
- running MsBuild from a command prompt with VS closed
As well as various combinations of the above.
My custom linker.xml contains an exception for my library project:
<?xml version="1.0" encoding="utf-8" ?> <linker> ... <assembly fullname="AppName.Core" ></assembly> ... </linker>
As this point I seem to have exhausted all available options and am no closer to a workable solution. Suggestions on solutions, workarounds, or other debugging paths to follow would be most appreciated.
My Android Options config:
Version Information:
- Visual Studio Version: 15.5.6
- Xamarin Forms Version: 2.5.0.280555
- Xamarin Version: 26.1.0.1
1 Answers
Answers 1
Please refer this link :
There are two solutions :
- Close Visual Studio
- deleting all the files in the bin\Debug folder
- delete the .suo file
- open Visual Studio in Administrator mode
If you have Xamarin Studio try this :
- Open the solution in XamarinStudio and deploy it to the Android phone
- Close the XamarinStudio
- Open the solution in VisualStudio and deploy it to Android Phone
Hope this helps!!
0 comments:
Post a Comment