Cannot connect to the targeted site
Visual Studio error when setting Site Url for Sharepoint project
Cannot connect to the targeted site. This error can occur if the specified site is not hosted on the local system. SharePoint solutions work only with locally-installed versions of SharePoint Foundation or SharePoint Server. Remote development is supported only for apps for SharePoint 2013.
Property value is not valid. Remote SharePoint site connections are not supported.
It could happen when your site url is host header site, so it's needed to add host header to hosts file.