Search code examples
ioscordovavisual-studio-2015visual-studio-cordovataco

Linking to an external www-folder - Tools for Apache Cordova (VS 2015)


For a project I'd like to use an existing website as a base for a cordova app. My project setup looks as follows:

  • One Solution with two projects
  • A ASP.NET webservice project (with website aka html/js/css)
  • An tools for apache cordova project

I don't want to copy the html/js/css files from the website on every build. Instead, I thought I could get away with some kind of a link to the www-folder in the ASP.NET project. I tried several approaches:

  1. Creating a filesystem link (tried 'mklink' with parameters /D and /J - /H is not working for directories
  2. Editing the .jsproj file and add a tag to link to the other project's www-folder

The second approach didn't work at all. Just got some weird errors when trying to load the project again (saying something about file duplicates).

The first approach worked a little bit: It is working, when targeting the windows platform. It is NOT working, when targeting iOS.

When targeting iOS, everything is copied just fine to the platforms\ios folder (read, all the content of the linked www folder is copied to the platforms\ios\www folder). But it is not copied correctly to the remote build tool on Mac OS X! It really just copies the directory link as a file. Remotebuild then failes with a 'missing www directory in top level' message.

  1. Any suggestions how to add a link so the content is copied (instead of the actual link)?
  2. Is there a way to take detailed influence on the build process for specific platforms?
  3. Is there a way to create a hardlink to a directory in windows? What are the drawbacks?

I'd really like to avoid copying the files on build (which would be simple enough with a prebuild script), because there's a high risk of loosing changes made while debugging.

I'm aware that setting a link is also not the best solution, since it has to be done per machine and can't be checked in to a version control system. So, if somebody knows of a better aproach to handle my scenario, let me know.


Solution

  • I work on the Tools for Apache Cordova in Visual Studio at Microsoft.

    I'm sorry but VS-TAC does not support add as link. To prevent confusion we removed the option in update 3.

    The best solution I can give you is to copy files from one project to another. Another user asked this question a week ago and came up with a hacky solution. Please see this for more information:

    VS2015 typescript cordova add as a link

    Sorry for the trouble and thank you for the feedback!