Sharepoint Online: Deploy Provider hosted app automatically - visual-studio

I deployed a new provider hosted Sharepoint app successfully (I used this tutorial: http://bhanuprakashbysani.blogspot.de/2014/11/how-to-publish-provider-hosted-app-in.html).
However, now I want to deploy the first update of my app. The only way I found out is to deploy it "manually":
Delete app on my SP developer site.
Menu "Apps in Testing"
New app to deploy
Upload ".app" file
This steps have 2 disadvantages I want to avoid:
I always have to delete my app before I upload the new version, else I get an error
These are manual steps, it would be perfect, if the update would work automatically.
Are there any possibilities to set my project up for these "autoamtic" updates?

To update your app you need to create a new version of the app and distribute in the App Catalog where it was distributed.
There are 2 things in the app manifest which controls the installation and upgrade process:
The product ID also called GUID. Do not change the value or
SharePoint will not recognise it as an update
The version number of the app. It's in a standard .Net format, by default it is 1.0.0.0. When you create a new version, you have to
increment this number.

Related

When running a new uwp app as an update to an old one, is there a way to NOT delete the local state on install?

I have associated my new app with the old one in the store, then when hitting Local Machine I get the message:
The app ____ is already installed on this machine.
if you continue with the current deployment , the existing app will be
uninstalled and the apps current state will be deleted.
are you sure you want to continue?"
I need to keep the local state folder as that's where I have saved user data in the first version of the app, I don't want my users losing data.
Does any one know of a way to achieve this ?
This will not happen for actual users of your application who download it from the Store. The issue here is that when debugged, the app is signed with a local certificate as opposed to the Store-signed version. If you want to debug this "update" scenario, the easiest way to do so is:
Checkout the older version of your app from Git
Run it with debugger
Add some data
Close the app
Checkout latest commit again
Run app

Deploying Azure Function Slot from Visual Studio deploys Production

Short: How do I create a publish profile in Visual Studio that deploys a deployment slot vs production slot?
Long: That moment when you get a Sev1 call saying that Production is busted and you know that minutes before you just fired off a deployment to your integration deployment slot. Yup that's what just happened to me and for the life of me I can't explain it.
So we have one deployment slot for our Azure Function app named "Int". When creating the publishing profiles, I simply used the "Create new profile" wizard in Visual Studio and chose "Select Existing" Azure App Service, and then drilled in on the "Int" Deployment Slot. Seemed pretty straight forward. Well doing so causes both Int AND Production to be deployed. This was certainly unexpected and obviously catastrophic.
After some digging in the Portal I found in the "Overview" section of our Azure Function app there's a "Download publish profile" button. Clicking it for Production as well as for INT yields two separate files with different users, destinationAppUrls, etc. The only thing that was the same between the two was the FTP publishUrl but I assume that the server would route to the appropriate root based on the credentials passed in.
As it stands in spite of the fact that I have two unique publish profiles, one for prod and one for int, deploying either of them updates both production and our deployment slot.
Here's a list of the things I've tried to fix this myself to no avail:
Deleted both publishing profiles from Visual Studio and recreated them via the Wizard.
Deleted both publishing profiles from Visual Studio and recreated them via the downloaded profiles from the portal.
Deleted the INT publishing profile, created a new FTP user in the portal for our INT deployment slot, updated the downloaded profile for INT, then imported it into Visual Studio. <== Honestly I think this was dumb because I don't think VS is using FTP to deploy. I could be wrong though.
Ensured AutoSwap is turned off.
Used an FTP client to manually login with the publish credentials. Turns out even though Production and Int have different "FTP Deployment Users" logging in as either points at the same location. (This ultimately seems to be the problem)
Clicked "Reset publish profile" on the deployment slot and re-downloaded profile.
Other than losing the autoswap feature which I'm not even losing, I suppose one way to work around this would be to create an entirely separate app thus forcing it to work properly. I really want to avoid that if possible though.
Thanks in advance for help here.
That shouldn't happen, but if I had to guess, you must have the same values for WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE defined in both apps. The former is the storage account where your app content will be saved, and the latter is the share name in that storage account. It's fine for both to share the same WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, but if you also share the same WEBSITE_CONTENTSHARE, then you'll end up with the odd behavior you're seeing.
Usually when you create the function app through the tooling it should create a new share with a random name for each app. If you deploy using an ARM template or some other method and set these both to be the same you'll run into that behavior.

How To Move Sharepoint App From Development Site To Production Site

I have created a SharePoint app in SharePoint online in visual studio. This consists of a client web part and a web app hosted in Azure. I have set up a development site and successfully managed to get the app to run. it's just basic at this point because I am more interested in determining how to get it into sharepoint.
But now I am trying to get that app into another site I am having major hurdles. Here are the steps I have taken.
I have deployed the web project. I am assuming this is successful since it shows the changes I make in the development site. I can't imagine that any settings need to be changed for deployment to another site since this deploys to the web app in Azure (I think)?
So the next step I do is Package the App to send to sharepoint online. The potential problems here are that I use the same ClientID and Client Secret I used for my development site. From what I have read this should be handled in the packaging process and no changes need to be made as I try to push the app into the new site. So I am assuming the clientID is not site specific?
So once I have that as a .app file I go to the newly created AppCatalog Site and upload the file.
Once uploaded I can see it in the product ID list as below.
Then I go to our test site and try to pull the app. As you can see it has a message under the app 'You can't add this app here'.
When I click on 'find out why' I get the below message.
I have been unable to find an answer on the web that explains what to do. It's very frustrating and have spent about 8 hours trying to figure this out. I'm sure it's some setting somewhere that needs changing, but don't know what that setting is. Can anyone help?
I am going to go ahead an answer this to save some poor soul in the future. The problem was with the App Manifest file. I had the Permissions => Scope set to Site Collection. This needs to be changed to 'Web'.

SharePoint 2013 App Deploy Error: "A different version of this App is already installed with the same version number"

I have developed a very simple Provider-Hosted App which I was deploying to our SharePoint Online Developer Site.
Testing was going fine, and I had deployed it several times to the site, before I suddenly received this error in Visual Studio 2012 after I hit F5:
Error occurred in deployment step 'Install app for SharePoint': A different version of this App is already installed with the same version number. You need to delete the app from the site and the site recycle bin to install this version.
The thing is, I had just deleted / removed my app from the Developer site and from the recycle bin right before I received this error.
Not sure if this is relevant: but one of the changes I made to the program was to give the App Write permissions for the Web scope via the AppManifest.xml file.
I'm not finding anyone with this exact error on Google search results, so I thought I'd be the first to post it here.
Any help / ideas? I'm fairly new to developing for SP13.
Thanks in advance
First off welcome to the world of SharePoint dev. SharePoint can be quite painful with holding onto things, but the solution in your case is fairly easy - anytime you make a change to the AppManifest increment the version number. This is done on the general tab of the AppManifest, or if you're directly editing the xml then it should be the third item in the App tag.
Changing to 1.0.0.1 should fix your problem straight away, it is also a good habit to get into as then when you are deploying an app manually (not hitting f5) you will be able to update the old version of the app instead of having to completely remove it.

ClickOnce application deployment issue for new update

I have a clickOnce application which is deployed as "Start the Application from the Web or a Network Share". So, fist time a user try to start the application, it will be downloaded and installed to an application cache on the local computer. My problem is that every time I do a release, I update the new files to the network share. But whenever user try to hit the URL, clickOnce will start the application from the cache instead of downloading the new version. I can go for two solutions:
Every time user closes the application on local system, cache should
be deleted.
If there is a way to get notification of new update
even if application is deployed as "Start the Application from the
Web or a Network Share" and next time it will delete the cache to
download new files.
Any other solution apart from above two will be
helpful.
Make sure when you publish that the Publish version is being incremented. I always check the box "Automatically increment revision with each publish".
If you make changes and deploy with the same version, click once will not update. Hope this helps.

Resources