0
votes

I just updated my Visual Studio 2015 to the latest Tools for Apache Cordova Update 8.1. I am now not able to select any emulators because the debug target dropdown is disabled. How can I get it re-enabled?

I have tried "Clear Cordova Cache" under Options and rebuilding the solution, but it's still disabled. Prior to updating from Update 8 to 8.1, everything was working fine.

This is what my toolbar looks like now: disabled debug target

Update

I have tried repairing VS 2015, then uninstalling TACO, reinstalling TACO Update 8.1. Now when I load up a Cordova project, the Debug Target dropdown is enabled, but only with the Google Android Emulator and Ripple emulators in the list. I cannot add any VS Android Emulators. Upon loading the project, I'm getting this error:

ApacheCordovaToolsPackage did not load correctly

Looking at the ActivityLog.xml, at the very end, I see this error:

<entry>
    <record>765</record>
    <time>2016/04/19 14:55:50.168</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [ApacheCordovaToolsPackage][Exception has been thrown by the target of an invocation.]:{   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.Activator.CreateInstance(Type type, Boolean nonPublic)&#x000D;&#x000A;   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)}</description>
    <guid>{317A330D-8757-4084-8526-E8A1D165433D}</guid>
    <hr>80131604</hr>
    <errorinfo>Exception has been thrown by the target of an invocation.</errorinfo>
  </entry>

I tried Michael's suggestion of running the devenv commands, but I'm still getting the same errors.

Any help would be greatly appreciated.

1
Can you try opening a developer command prompt as administrator and running devenv /setup, and then devenv /updateconfiguration?Michael Braude
@MichaelBraude I tried the commands, but still getting errors. See my update. Thanks for your help.Ionian316
Thanks for posting the PLF error, that's very helpful. It looks like the MEF cache is bad or corrupted. I can't tell why, but to fix it, can you close VS, delete this directory and retry? %localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCacheMichael Braude
@MichaelBraude Thanks. Deleting that directory made the error message go away, but the debug target dropdown is still disabled. I even re-ran the devenv commands.Ionian316

1 Answers

0
votes

After having Microsoft developers tried to help me to no avail, I started using TACO CLI and VS Code as an alternative (a pretty good one except it lacked the JavaScript Language Service output which enabled me to see all the console outputs). However, I think I finally found a fix to re-enable the target dropdown.

Initially, I tried removing VS 2015 Update 2 and reinstalling it. That actually enabled the dropdown for a few days. Then one day it started being disabled again. This is what I did to re-enable the dropdown:

  1. Close your solution in VS 2015.
  2. Open up the file "%LOCALAPPDATA%\Microsoft\VisualStudioEmulator\Android\configurationsBackup.xml ".
  3. Search for a device profile you have installed using Visual Studio Emulator for Android. Copy the id attribute value from that <configuration> tag. Copy the device.name value as well.
  4. Open your app's .jsproj.user file. Under the <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Android'"> item, change the value in <AndroidEmulatorID> to the ones you copied from configurationBackup.xml. For example, for the 5.7" Android 5.0 profile, the entire tag will be <AndroidEmulatorID>61B433CF-8C92-4CEA-9CA1-009DC946ED7E;VS Emulator 5.7" Lollipop (5.0) XHDPI Phone</AndroidEmulatorID>
  5. Save the .jsproj.user file. Open your solution from VS 2015.

Not sure if all the steps were necessary, but it enabled the dropdown for me. Hope this helps anyone who encounters this issue.