Skip to content
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

Build -> Archive command hangs, "Please ensure that you are using a release configuration and that "Use Shared Mono Runtime" option unchecked." #1760

Closed
xufeipyxis opened this issue May 31, 2018 · 40 comments
Labels
bug Component does not function as intended.

Comments

@xufeipyxis
Copy link

Steps to Reproduce

  1. Set a project to release and build, and then Build -> Archive

Expected Behavior

Create an archive

Actual Behavior

It never completes.

capture

I'm using release configuration and "Use Shared Mono Runtime" option is unchecked

    <BundleAssemblies>true</BundleAssemblies>
    <AotAssemblies>false</AotAssemblies>

This is my release configuration. I know this options are not available in the community verison of VS2017, but I can change it manually and reloade the project. It used to compile ok in April and earlier. I'm not sure if something changed in recent VS update.

Version Information

15.7.1

Microsoft Visual Studio Community 2017 (VS2017)
Version 15.7.1
VisualStudio.15.Release/15.7.1+27703.2000
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Community

Visual C++ 2017 00369-60000-00001-AA302
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package 8.12.10405.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.0.40501.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.7.31476
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60419.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.0.40424.0
Azure App Service Tools v3.0.0

C# Tools 2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Dotfuscator Community Edition 5.34.0.6830-9173b9a63
PreEmptive Protection - Dotfuscator CE

GorillaPlayerPackage Extension 1.0
GorillaPlayerPackage Visual Studio Extension Detailed Info

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

JavaScript UWP Project System 2.0
JavaScript UWP Project System

JetBrains ReSharper Ultimate 2017.2.2 Build 109.0.20171006.122324
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.

Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Continuous Delivery Tools for Visual Studio 0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 4.10.5-pre (ab58725)
Support for debugging Mono processes with Visual Studio.

Node.js Tools 1.4.11027.3
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

OzCode 1.0
Your road to Magical Debugging. http://www.oz-code.com

OzCodePackage Extension 1.0
OzCodePackage Visual Studio Extension Detailed Info

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61804.210
Microsoft SQL Server Data Tools

TypeScript Tools 15.7.20419.2003
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.1 for F# 4.1 15.7.0.0. Commit Hash: 16ecf5a30ad868d183c58e4a71a71c23d4ed3ba9.
Microsoft Visual F# Tools 10.1 for F# 4.1

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Unity 3.7.0.1
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps 15.0.27703.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Windows Machine Learning Generator Extension 1.0
Windows Machine Learning Visual Studio Extension Detailed Info

WiX Toolset Visual Studio Extension 0.9.21.62588
WiX Toolset Visual Studio Extension version 0.9.21.62588
Copyright (c) .NET Foundation and contributors. All rights reserved.

Xamarin 4.10.0.442 (396b18cef)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.12.264 (fc37cd02e)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK 8.3.0.19 (HEAD/342b2ce96)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.10.1.177 (7e782c1)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

@xufeipyxis
Copy link
Author

When I check the output of Xamarin, it says:

Shared Mono runtime is enabled for ''.
The selected build configuration is using the shared Mono runtime for faster deployment. Apps cannot be archived with this setting enabled.
Please ensure that you are using a release configuration and that the "Use Shared Mono Runtime" option in your project's build options is unchecked.

@JonDouglas
Copy link
Contributor

@xufeipyxis Can you please provide your most recent ide logs after encountering this issue found inside the Help -> Xamarin -> Zip Logs option? This should have a few more clues as to why this is failing.

You should be able to build on the command line via:

msbuild <project.csproj> /t:SignAndroidPackage /p:Configuration=Release

If that fails, it should give a proper error message as to what's wrong.

@JonDouglas JonDouglas added the need-info Issues that need more information from the author. label May 31, 2018
@xufeipyxis
Copy link
Author

15.0.zip

@JonDouglas
Copy link
Contributor

@xufeipyxis I see two different issues here.

  1. It seems that when loading your AndroidManifest.xml it is finding an undeclared element. Perhaps this is causing the build to fail and thus the archive? Are you able to build normally without using the archive step?

  2. Archiving fails with the following:

Xamarin.VisualStudio.Publishing.Presentation.ViewModels.ArchiveListViewModel|Error|0|System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Xamarin.VisualStudio.Publishing.Presentation.ViewModels.ArchiveListViewModel.<<SubscribeToEvents>b__56_5>d.MoveNext() in E:\A\_work\5\s\src\Core\VisualStudio.Publishing\Presentation\ViewModels\ArchiveListViewModel.cs:line 262

Please also update to 15.7.3 that we released yesterday that include a few bug fixes.

@xufeipyxis
Copy link
Author

I created a new Xamarin.Android project and it achieved ok. I will check my project.

@EmilAlipiev
Copy link

I am having the same problem. why did you close this without a solution? I dont think that this has something to do with any of these above.

  1. I havent changed my manifest for months and this is suddenly appeared using latest version of VS2017 update.
  2. I have the same error message in my zip logs i dont know what is ArchieveListViewModel. this should be something from xamarin. I havent got such viewmodel

I am sure that this bug is related to this ticket #1651
Because archiving works fine once you remove bundle into native assemblies.

@EmilAlipiev
Copy link

EmilAlipiev commented Jun 14, 2018

I just tried using command line and it looks like that it is working fine. Not sure if that it is just building or also archiving. but no error at all.

@JonDouglas this has nothing to do with build. Build works just fine. only archiving fails. how do you understand that he has a problem in his manifest? my logs looks the same but i dont see anything related to manifest

@EmilAlipiev
Copy link

EmilAlipiev commented Jun 14, 2018

Ok i see that he has something regarding manifest in his log bu in my log, i dont have anything related to it.
@JonDouglas please find my log file.
in the log, i dont understand these lines below. I am not building or archiving Ios Project and I even unchecked build and deploy option for ios, why would i get something like below. is there something messed up between Android and Ios in the latest xamarin or vs update? I am on latest xamarin forms update.

Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject|Information|0|Beggining Build for C:\Git\myApp\myApp\myApp.iOS\myApp.iOS.csproj. Properties: ContinueOnDisconnected: True, ServerAddress:
Xamarin.VisualStudio.Publishing.Presentation.ViewModels.ArchiveListViewModel|Error|0|System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Here is how my configuration looks like for android release

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <DebugType>portable</DebugType>
    <AndroidLinkMode>Full</AndroidLinkMode>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
    <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
    <AotAssemblies>false</AotAssemblies>
    <EnableLLVM>false</EnableLLVM>
    <AndroidAotAdditionalArguments>no-write-symbols,nodebug</AndroidAotAdditionalArguments>
    <DebugSymbols>false</DebugSymbols>
    <BundleAssemblies>True</BundleAssemblies>
    <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
    <EnableProguard>true</EnableProguard>
    <Debugger>Xamarin</Debugger>
    <AndroidSupportedAbis>armeabi-v7a;x86;x86_64</AndroidSupportedAbis>    
    <AndroidEnableMultipleDex>true</AndroidEnableMultipleDex>
    <AndroidExplicitCrunch>true</AndroidExplicitCrunch>
  </PropertyGroup>

2018-06-14_12-42-08.71040.Ide.log

@JonDouglas
Copy link
Contributor

/cc @joj as this looks to be more specific with Visual Studio archiving as a command line build works. Reopening as we have had a second report on this issue.

@JonDouglas JonDouglas removed the need-info Issues that need more information from the author. label Jun 14, 2018
@EmilAlipiev
Copy link

I have just tested my application an VS2017 enterprise version and this error is not happening. this is only error for Community and Professional versions. so basically archiving

- Enterprise : Bundle into native assemblies works, without bundling works
-Pro and Community: without Bundling works, Bundle into native assemblies=true fails with this error message.

@EmilAlipiev
Copy link

Latest version 15.7.4 also has this problem

@xufeipyxis
Copy link
Author

It seems that it's also related to the code sharing strategy. When it's shared project, it's ok; but it failed for .net standard project.

@EmilAlipiev
Copy link

@xufeipyxis i am not sure if it is correct because i have 2 machines as i mentioned above one has Vs2017 pro and other one Vs2017 enterprise. same project archives fine on enterprise but fails on professional. as OP stated apparently also problem for community version

@joj
Copy link
Member

joj commented Jun 25, 2018

I'll take a look and post back here. We usually don't make any checks for Enterprise/Community/Professional (except for the few components that are Enterprise only) but something might have gone wrong. I'll keep you posted.

@joj
Copy link
Member

joj commented Jun 25, 2018

BTW, the exception mentioned above

Xamarin.VisualStudio.Publishing.Presentation.ViewModels.ArchiveListViewModel|Error|0|System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

has been fixed. The fix will be in preview soon.

@JonDouglas JonDouglas added the bug Component does not function as intended. label Jun 25, 2018
@joj
Copy link
Member

joj commented Jun 25, 2018

I tried the repro. It looks like the UI is not super clear, but an error message is shown about Shared Use Runtime (which is unchecked, too). Now I need to understand why this only happens in community/pro, and what we can do to make that error message clear. This looks like it's hanged, but it's actually not going to go through because of that error. Also, Shared Runtime is unchecked on my case, so this message shouldn't be shown. I'll keep updating as I figure out what's happening and fix it.

@joj
Copy link
Member

joj commented Jun 25, 2018

Found the bug. It manifests in Community for some reason but has nothing to do with community. The good news is that restarting VS is a valid workaround. It works after that, with the correct settings. I'll be working on a fix.

@joj
Copy link
Member

joj commented Jun 27, 2018

Still on this. It seems the bug exceeds Xamarin and I may need to forward it. I'll keep updating here, though.

@EmilAlipiev
Copy link

It still problem with the latest 15.7.8 update.

@ubidyanand
Copy link

Remove the "Use Shared Runtime" from Debug mode as well. It don't work in Release mode if "use shared runtime" is enable for Debug configuration.

@xufeipyxis
Copy link
Author

xufeipyxis commented Sep 19, 2018

I can't believe it but deleting the .vs folder did fix the issue here.
My steps are:

  1. Add <BundleAssemblies>true</BundleAssemblies> <AotAssemblies>true</AotAssemblies> to the .csproj file, save it.
  2. close Visual Studio
  3. delete the .vs folder (it's a hidden folder)
  4. Open Visual Studio again, switch to release and build
  5. archive.

@dfoulk
Copy link

dfoulk commented Sep 19, 2018

I'm experiencing this is VS2017 Pro. All that we had to do was (close Visual Studio) delete the .vs folder and restart Visual Studio.

@kkarakk
Copy link

kkarakk commented Sep 27, 2018

I experienced the same issue just now while trying to deploy an application to the play store. the error(unable to sign app) and the solution(deleting .vs hidden folder in project solution) are completely unrelated to me as a beginner in xamarin android, really frustrating bug.
I am using VS2017 Community edition on windows

@Denny966
Copy link

Got the same problem, closing visual studio and deleting .vs folder works, but it's quite annoying to do that every time.

Microsoft Visual Studio Enterprise 2017
Version 15.8.2
VisualStudio.15.Release/15.8.2+28010.2016
Microsoft .NET Framework
Version 4.7.03056

@derekwheeler-tylertech
Copy link

derekwheeler-tylertech commented Oct 2, 2018

Same problem here. Restarting studio after deleting .vs folder worked.

Microsoft Visual Studio Enterprise 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.03056

Xamarin 4.11.0.776 (d15-8@1ae9b59d7)
Xamarin.Android SDK 9.0.0.19 (HEAD/a8a3b0ec7)

@erdmenchen
Copy link

Same here, a simple restart without deleting the .vs folder worked, too.

@llauderesv
Copy link

Same problem here. Closing Visual Studio and delete .vs folder under my project. Resolve this issue

@JeetR
Copy link

JeetR commented Oct 16, 2018

Deleting .vs folder and restarting visual studio resolved my issue

@ianvink
Copy link

ianvink commented Nov 21, 2018

Same problem with VS 15.9.2 - Restarted VS fixed it. Note that I built a release branch first and pushed it to a device, then archived. Perhaps that previous release build had something to do with it.

@thomasgalliker
Copy link

Same problem with VS 15.9.3 - Restarted VS fixed it. 4h of troubleshooting wasted on this...

@kyle-seongwoo-jun
Copy link
Contributor

kyle-seongwoo-jun commented Dec 19, 2018

Same problem with VS 15.9.3

  1. Exit VS
  2. Delete .vs folder
  3. Start VS and Archive it.
  4. Problem solved

@vincentcastagna
Copy link

Got the same issue. Don't know when it appeared but I updated VS one week ago ... VS 15.9.4

@JeetR
Copy link

JeetR commented Jan 10, 2019

Got the same issue. Don't know when it appeared but I updated VS one week ago ... VS 15.9.4

Did You try deleting obj, bin and .vs folder and restarting visual studio and rebuilding your project?
You can also restart your system once after deleting the folders.(once restarting helped me fix the issue)

@vincentcastagna
Copy link

Yep. It did the job (deleting .vs folder & restart). My post was informative :). Thanks

@dfoulk
Copy link

dfoulk commented Jan 10, 2019

@JeetR's solution will fix 99% of issues that arise in projects that have worked previously.

@Thijmen
Copy link

Thijmen commented Feb 1, 2019

Having this problem too. Sometimes it looks like the compiler doesn't even compile my new written code, e.g. click events not working in my app. A clean of the whole project will fix it.

It works, but really annoying.

@BladeMF
Copy link

BladeMF commented May 9, 2019

Having the same problem too.

@EmilAlipiev
Copy link

15.9.12 on VS2017, it is still problem.

@tigreye007
Copy link

Agreed. In 15.9.12, I reproduced this myself. Simply closing and restarting VS2017 (Community) works as a workaround. The only thing I can note is that I was doing a LOT of debugging in the same session I performed a Release Clean/Rebuild/Archive in - is it possible that this has something to do with it?

@createS0ftware
Copy link

createS0ftware commented May 14, 2020

What i found is that you need to select Release in Build->Configuration Manager in the menu.

Then if you run Archive, it will work. You can choose to have the Release tag on just Android or IOS individually.

@xamarin xamarin locked as resolved and limited conversation to collaborators Jun 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Component does not function as intended.
Projects
None yet
Development

No branches or pull requests