2

Question. I have Visual Studio 2017 community and I created a Cordova project and set the toolset to Global Cordova 7.0.1, compile and it works great. Save the project and close Visual Studio.

Now, open Visual Studio and then open that project again and it tells me I need to update the project so it will work with Visual Studio 15. I click YES and now the toolset seems to be changed to 6.0.1.

Anyone know how to fix this? It's driving me crazy and I don't wan to rebuild the machine.

1 Answers1

1

This can be solved by editing config.xml to replace the toolset and android-cordova versions. This works as long as you create a new project.

Follow these steps:

Go to File > New > Project > Blank App (Apache Cordova)

Open config.xml in View Code mode and find this:

<vs:toolsetVersion>6.3.1</vs:toolsetVersion>
<engine name="android" spec="5.2.1" />

Replace with:

<vs:toolsetVersion>7.1.0</vs:toolsetVersion>
<engine name="android" spec="6.3.0" />

Where 7.1.0 is your globally installed Cordova version.

Select Device as target.

Now Build > Build Solution

Save, close and reload the project. When you access config.xml in designer mode you'll see Global Cordova 7.1.0 as the selected toolset.

enter image description here

In order to build you may need to use the external Android SDK Build Tools (API 26) instead of the ones provided by Visual Studio (API 25).

enter image description here

Use the Android SDK Manager to manage versions, no need to get Android Studio for this.

enter image description here

Remember to follow the guidelines from Microsoft when changing the CLI on existing projects. However I strongly recommend creating a new one and then importing your files and adding your plugins to avoid potential problems.

andreszs
  • 2,896
  • 3
  • 26
  • 34