Can't install Apache Cordova plugins in Visual Studio 2017 - cordova-plugins

I created a very simple Apache Cordova Javascript project in Visual studio 2017, and then trying to add the 'device' plugin listed on the Core tab, and then failed with this error:
Installing plugin 'cordova-plugin-device'
You have been opted out of telemetry. To change this, run: cordova telemetry on.
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-device, retrieving version from config.xml
No version for cordova-plugin-device saved in config.xml
Attempting to use npm info for cordova-plugin-device to choose a compatible release
Done
Error: tunneling socket could not be established, cause=socket hang up

I was facing the same error and it was causing because of the path of the plugin where i placed it was too long.I placed it in a folder in E:/ drive and then tried to add it.And it was added successfully.Try doing this.

Related

Building .a NET Core project using Jenkins always references the latest installed SDK version

I'm running a "Build a Visual Studio project or solution using MSBuild" on Jenkins for several projects to generate nuget packages.
The MSBuild used is the latest Visual Studio Build Tools
The version of the .NET Core sdk used in the project is 1.0.4
Company.Core.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
However while executing a build the used SDK version is always the latest SDK installed on the machine (2.x).
C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5):
error NETSDK1064: Package Microsoft.CSharp, version 4.0.1 was not found.
It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
[C:\Workspaces\Company.Core\Company.Core.csproj]
After uninstalling the 2.1.400 SDK version i get the error:
C:\ProgramFiles\dotnet\sdk\1.1.10\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(308,5):
error : Assets file 'C:\Workspaces\Company.Core\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Workspaces\Company.Core\Company.Core.csproj]
The installation used to support .net Core 1.0.4 was .NET Core 1.0.4 & 1.1.1 SDK 1.0.1 using the instructions:
Windows Server Hosting
If you are looking to host stand-alone apps on
Windows Servers, the ASP.NET Core Module for IIS can be installed
separately on servers without installing .NET Core runtime. You can
download the Windows (Server Hosting) installer and run the following
command from an Administrator command prompt:
DotNetCore.1.0.4_1.1.1-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0
OPT_INSTALL_FTS_REDIST=0
I also added RuntimeFrameworkVersion in the csproj that had no effect.
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>^
global.json also gets ignored
{
"sdk": {
"version": "1.0.4"
}
}
It looks like you can specify the sdk version in a global.json file:
{
"sdk": {
"version": "1.0.4"
}
}
Source:
https://markheath.net/post/switching-between-netcore-sdk-versions
I think there's some confusion here. .NET Core consists of two almost separate components: the SDK and the Runtime. The SDK is used to build your code and the runtime is needed to run it.
They are versioned differently. For example, the latest SDK is 2.1.403, while the latest Runtime is 2.1.5.
A recent version of SDK can target any version of the runtime released before it. So, a 2.1.403 SDK can build applications that need 2.0 or 1.0 to run.
You can force a particular SDK to be used, by using the global.json file. You need to specify a version of the SDK that is already installed. dotnet new globaljson will generate something that you can edit the versions in. But you shouldn't need to do that. You can just use the latest SDK and ask it to build for an older runtime by setting the TargetFramework as you do.
If you do a dotnet restore, does the error NETSDK1064: Package Microsoft.CSharp, version 4.0.1 was not found. still stick around? The second error, Assets file 'C:\Workspaces\Company.Core\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. backs this up. The project.assets.json is created by dotnet restore. Could you simply be missing that step?

How to setup android ndk in jenkins on linux

I have jenkins on ubuntu. Building worked fine until I started to use android ndk.
latest ndk is downloaded and extracted into /opt/android-sdk-linux/ndk-bundle
In /etc/profile.d/android.sh is:
export ANDROID_HOME="/opt/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
export ANDROID_NDK_HOME="/opt/android-sdk-linux/ndk-bundle"
but I got still error:
:common:compileDebugNdk FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':common:compileDebugNdk'.
NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/. Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
The message says it all. You should add a text file local.properties to the project directory on the Linux machine, with one line
ndk.dir=/opt/android-sdk-linux/ndk-bundle
This file is usually in .gitignore, and Android Studio generates it automatically. But when you build your project in Jenkins, it does not open Android Studio.

VS Cordova IOS Remote Build

I am new to cordova and trying to get my env all set up. I was able to successfully get an ios cordova app running on my mac. I then installed the remote build agent for vs and tried to create a new ios project in vs. In ripple it works fine but when I try to do a remote build I get the following error
Remote build error from the build server Build failed with error
Plugin doesn't support this project's cordova-ios version.
cordova-ios: 3.8.0, failed version requirement: >=4.0.0-dev:
{1} BlankCordovaApp1
Where do I set the cordova-ios version for the project?
This is coming from the cordova-plugin-whitelist plugin included with new Visual Studio Typescript projects by default. The values are inside plugins/cordova-plugin-whitelist/plugin.xml.
In theory you could change the cordova-ios version number in this file, but I couldn't get that to work, so I just removed the whitelist plugin altogether.
Remove the plugin by deleting it from the /plugins folder and removing the following from the project's config.xml:
<!-- Support for Cordova 5.0.0 plugin system -->
<plugin name="cordova-plugin-whitelist" version="1" />
The latest version 1.1.0 requires cordova-ios 4.0.0 as the error message suggests. Version 1.0.0 does support 3.8.0 so an easy fix is to use that version instead. To use 1.0.0 you can add the following to the
config.xml
<vs:plugin name="cordova-plugin-whitelist" version="1.0.0" />
You might need to update your Visual Studio 2015 Cordova Tool. From Visual Studio 2015 click on Tools-> Extensions and Updates. If you need the update, you would see a Apache Cordova Update listed. If so complete the install and that should solves your issue.
Cheers

Visual Studio 2015 RTM Cordova IOS Build Error - Could not find module 'Q'

I am using Visual Studio 2015 RTM, and I am working on a Cordova project. My project works fine for Android, but I cannot get it to build for IOS. I have figured out what the problem is, but I cannot figure out how to fix it.
When I build for IOS it is sending the build to the remote build agent installed on my Mac computer, but it is returning the following error:
Could not find module 'Q'. Please Go to Tools --> Options --> Tools
for Apache cordova --> Cordova Tools --> Clear Cordova Cache and try
building again.
Following it's suggestion and clearing the Cordova cache does not help. I did some research and have found that it is a bug in the cordova_ios library. Here is a link to the commit that fixed the error https://github.com/apache/cordova-ios/commit/ed272032878959c90eb28ccc1490e96fb7b69287.
Basically what the issue is that the check_reqs.js file is require 'Q' (uppercase) instead of 'q' (lowercase).
I can work around the problem (and confirm that this is the problem) by doing the following:
Copy my Cordova project over to my Mac computer.
At the command line add IOS as a Cordova platform.
Go to the /platforms/ios/cordova/lib/check_reqs.js file and change line 25 to be a lowercase 'q'.
Build and run the project on the Mac.
What I don't know is how to fix this in Visual Studio so I can build from Visual Studio? I have tried doing NPM updates on the computer that Visual Studio is installed on, but that has not fixed it. I have also tried to manually add the IOS platform to my project via the Cordova command line, and then changing the same file that I change on the Mac, but that does not fix it either.
It looks like this issue if fixed in the latest version of the cordova_ios library, I just cannot figure out how to get Visual Studio and/or the remote build agent on my Mac to use the latest version of the cordova_ios library.
Update
It looks like this is a bug that other people are seeing with Cordova. There are discussion about it here and here. I can reproduce this on my Mac computer. If I create a new Cordova project and add the iOS platform and try to build it for iOS I receive this error. I can then correct the issue by opening the check_reqs.js file and changing the uppercase 'Q' to a lowercase 'q'. However when I build from Visual Studio it sends the project across to the Mac with the incorrect check_req.js file and the build fails. I cannot figure out how to correct this issue when doing a iOS build from Visual Studio.
If your OSX machine has case a case sensitive filesystem you can hit this though a fix is in the works. (Most people do not turn on case sensativity.)
The fix you reference has not yet been released publicly. You can watch for a "platform" release here: http://cordova.apache.org/
Once the platform is released it is very likely a Cordova CLI update will also occur (ex: 5.1.2) so you can just update to that version via the config designer.
However, as an alternative you can add the following into your config.xml file to cause Cordova to use a different iOS platform version and then do a "clean" in VS to force it to take effect:
<engine name="ios" spec="3.9.0" />
3.8.0 is the currently released version.
A "DISCUSS" thread is already going for an iOS release - it should be out in the next couple of weeks.
You can try using the Git URI to get edge - but that could be buggy so exercise care:
<engine name="ios" spec="https://github.com/apache/cordova-ios.git" />
I think we should simply do a patch release of Cordova with this bug fix. Will start a thread on the mailing list to see if a quick release is possible.
Did you already try re-installing vs-tac? Here's the doc:
https://msdn.microsoft.com/library/dn771551(v=vs.140).aspx#vstac
What version of node do you have installed on the MAC machine? I have 0.12.2 and the require(Q) gets satisfied without any errors. Can you try installing a newer version of Node? Let me know.

TFS (web) gives error when building Typescript. TypeScript.targets not found

We just converted our javascript files to typescript. Everything builds locally just fine but our build in TFS (cloud version i.e. tfs.visualstudio.com) gave us the error:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets"
was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Locally we are using typescript version 0.9.1.1 and VS2012
And advise?
To ensure that Web projects using Microsoft.TypeScript.targets will build successfully on a build server, you have two options:
Install TypeScript on the build server
Copy the required files for Microsoft.TypeScript.targets to a different source-controlled folder and change the path references in
the csproj file to this folder.
More details here => http://typescript.codeplex.com/workitem/1518
Usually this is because you haven't installed the TypeScript extension on the build server - it will need the same installer you used locally.
This will put tsc.exe into the SDK/Typescript folder and allow the build server to build your TypeScript files and check all your types.
I had to install Visual Studio 2013 RC2 to get TypeScript installed by default and get rid of this error message, instead of trying to download a package.
It can be found here:
http://www.microsoft.com/fr-fr/download/details.aspx?id=42666
This message usually throws when you cancelled the installation of VS or changed the Typescript version or failed to install the Typescript SDK for the corresponding Visual Studio Edition. Download and install the Typescript SDK can get you rid of this error.
Here is the link for downloading SDK for VS2017.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=55258

Resources