How to Open Old Multi Device Hybrid Apps in Visual Studio

How to Open Old Multi Device Hybrid Apps in Visual Studio

After migrating my work files to a new computer and installing Visual Studio and the latest Multi Device Hybrid Apps plugin for Cordova development, I began encountering issues when opening my Phone Gap projects in Visual Studio with errors such as "One or more projects in the solution were not loaded correctly. Please see the Output Window for details.


I did as instructed and checked the Output Window to find that the issue was occuring in the \AppData\Roaming\npm\node_modules\vs-mda-targets\ directory. It appears some changes have occurred in how the Import statements are structured in Visual Studio between the CTP2.0 Hybrid Apps plugin and subsequent releases.


The error reads: The imported project "C:\Users\<your username>\AppData\Roaming\npm\node_modules\vs-mda-targets\Microsoft.MDA.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Luckily, Microsoft has provided a simple fix for the javascript project files for this issue:

Open the jsproj file in the editor (Right-click and select Edit myproject.jsproj) and modify the path in following lines: 
<Import Project="$(AppData)\npm\node_modules\vs-mda-targets\Microsoft.MDA.targets" /> 
<Import Project="$(AppData)\npm\node_modules\vs-mda-targets\Microsoft.TypeScript.MDA.targets" />

To look like these: 
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\Microsoft.MDA.targets" /> 
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\Microsoft.TypeScript.MDA.targets" />

For more assistance with opening CTP2.0 Multi Device Hybrid Apps solutions when using later versions of the plugin, check out Microsoft's FAQ:


Cordova   Microsoft.MDA.targets   Multi Device Hybrid Apps   Phone Gap   Visual Studio   vs-mda-targets  
Find this helpful? Share it with others:

Posted Wednesday, January 21, 2015