3
------ Build started: Project: SharePointApp2, Configuration: Debug Any CPU ------
  Successfully created package at: c:\users\bob\documents\visual studio 2015\Projects\SharePointApp2\SharePointApp2\bin\Debug\SharePointApp2.debugapp
------ Deploy started: Project: SharePointApp2, Configuration: Debug Any CPU ------
Active Deployment Configuration: Deploy App for SharePoint
  Skipping deployment step because a pre-deployment command is not specified.
  Uninstall app for SharePoint:
  Retraction is in progress (00:00:01)
  Retraction is in progress (00:00:03)
  Retraction is in progress (00:00:05)
  Retraction is in progress (00:00:07)
  Retraction is in progress (00:00:09)
  Retraction is in progress (00:00:11)
  Retraction is in progress (00:00:13)
  Retraction is in progress (00:00:16)

This retraction added in with the installation times are adding up to long periods of time waiting every time I change some code and rebuild the solution.

Is there a way to speed up the build process and not have to always uninstall the whole app and reinstalling it back to SharePoint?

4

UPDATE 3

Here's another option I just found: gulp-spsave. In VS, you can setup gulp and gulp-spsave and run via Task Runner Explorer on Project Start. Works for SharePoint Add-ins and SharePoint NCSS solutions, and has the added benefit of being able to watch JS files that are generated from multiple TypeScript files, which is something that SPFastDeploy can't do at the moment.

Highly recommend looking into it. It's been a lifesaver on the NCSS solution front.

Example gulpfile config for an add-in. This watches all updates to the app.js file. If a TS file is edited, VS rebuilds app.js, and gulp-spsave pushes it to the /Scripts folder in the add-in web:

var gulp = require("gulp");
var spsave = require("gulp-spsave");

var coreOptions = {
    siteUrl: 'https://your-cool-company.sharepoint.com/sites/the-site-collection/my-sweet-addin',
    scriptSrc: ["./Scripts/app.js*"]
};
var creds = {
    username: 'you@your-cool-company.com',
    password: '12345'
};
gulp.task("app-js", function () {
    return gulp.src(coreOptions.scriptSrc, { base: "Scripts" })
        .pipe(spsave({
            siteUrl: coreOptions.siteUrl,
            folder: "Scripts",
            flatten: false
        }, creds));
});
gulp.task("app-js-watch", function () {
    return gulp.watch(coreOptions.scriptSrc, ["app-js"])
});

Note that the above ONLY watches the app.js output. You would need to add some additional config to get gulp-spsave to watch other content in your add-in.


UPDATE 2

Forget everything I said below and go with the answer provided by @Leif-Walder.


This post is a little older and you may have fixed it by now, but I thought I'd share my experience anyway.

Over the past week this retract/deploy process was causing me endless grief. I was able to get around most of the pain by creating a custom Deployment Configuration in the project properties -> SharePoint tab with minimal steps:

Deployment Config Screen

Here are the settings I used:

enter image description here

Once the add-in is deployed the first time, the retract and install process is dropped entirely. Debugging start up has been taking me < 30 seconds, which is tolerable given the 3 - 5+ minutes it was taking before.

There are certain things in which a retract is necessary, such as changing the add-in's security settings, however you can do that as a one-off rather than every time you debug.

Hope this helps!

UPDATE

I found this is only a partial fix. While some content is deployed in this scenario, javascripts are not. Which basically negates the usefulness of the stripped down deploy process.

I've had some luck with enabling retraction "after debugging is complete" (setting is in the SharePoint tab). This removes the retraction step during debugging, which helps, but it's still not a great solution.

If anyone has any additional ideas on how to make this debugging process better, I'm all ears.

3

To speed up the build process I would recommend 'SPFastDeploy'.

It is an Extension for Visual Studio and can be installed from Visual Studio -> Tools -> Extensions and Updates. select "online" and search for 'SPFastDeploy'. once it is installed you simply save any e.g. *.html *.aspx *.js in visual studio when the project is running and the Extension sends the changes to the app in SharePoint.

credit goes to Steve Curran.

  • You just saved my life. – Jim Barntish Dec 19 '16 at 20:16
1

If you've only made changes to the web project, try rebuilding only the web project and attach the debugger to the IISExpress.exe (Managed...) process. This way you do not need to press the green arrow (effectively preventing retraction and redeploying). You can only do this once IISExpress is up and running, so you do need to run your app once using the green arrow.

Hope this helps.

0

Try to right click the Project, go to Sharepoint Tab on the left and than uncheck the Auto-retract checkbox.

  • It was already unchecked. :( – user2677821 Jul 22 '16 at 18:08
0

I've seen this before with certain apps. What's I've done is that once the app is running in my browser, I would not stop or reload it from Visual Studio.

Instead I would save the changes in Visual Studio and just refresh the browser. Refreshing the browser will pull in the changed code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.