Navigation Bar

Friday 3 August 2012

Developing First App for SharePoint 2013

Today finally I got my vm configured for development of Apps for SharePoint. I had couple of issues while configuring the vm that I want to share with you.

The first challenge was setting up app domain and the other was installing tools for SharePoint apps.

Following are the steps I performed to get my vm configured for apps development:

1) Installed SharePoint 2013 Preview (i.e obvious)
2) Created a site at http://myserver using Developer Site Template template
3) Enable and Restart SharePoint Administration Timer service
4) If you are running it twice or you have already created 'SettingsServiceApp' and 'AppServiceApp' service app then you have to delete it before running this script.
5) Ran the script, I will share that script with you

To install developer tools, you need to install sharepointclientcomponents_x64.msi first and then OfficeToolsForVS2012RCPreview.3f.3f.3fnew.exe

Here is the script that I used in step 4:
start of script
#--------------------------------------------
write-host "starting admin and timer service"
net start spadminv4
net start sptimerv4
write-host "setting apps.mmasood.com app domain..."
Set-SPAppDomain "apps.mmasood.com"
write-host "Ensuring that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running..."
Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance
Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}
write-host "Checking managed account..."
$account = Get-SPManagedAccount | where {$_.UserName -eq "myserver\Administrator"}
if($account -eq $null){
 write-host "Creating new managed account"
 $account = New-SPManagedAccount
 write-host "Managed account created."
}
else{
 write-host "Managed account already exists."
}

$appPoolSubSvc = Get-SPServiceApplicationPool | where {$_.Name -eq "SettingsServiceAppPool"}
if($appPoolSubSvc -eq $null){
 write-host "Creating SettingsServiceAppPool..."
 $appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
 write-host "Creating SettingsServiceAppPool...done"
}
else{
 write-host "SettingsServiceAppPool already exists."
}
$appPoolAppSvc = Get-SPServiceApplicationPool | where {$_.Name -eq "AppServiceAppPool" }
if($appPoolAppSvc -eq $null){
 write-host "Creating AppServiceAppPool..."
 $appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account
 write-host "Creating AppServiceAppPool...done"
}
else{
 write-host "AppServiceAppPool already exists."
}
write-host "creating service apps 'SettingsServiceApp'..."
$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SettingsServiceDB
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
write-host "creating service apps 'SettingsServiceApp'...done"
write-host "creating service apps 'AppServiceApp'..."
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName AppServiceDB
$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
write-host "creating service apps 'AppServiceApp'...done"
write-host "creating service apps...done"
write-host "setting tenant..."
Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
write-host "setting tenant...done"
#----------------------------------------------------------

After that I created a HelloworldApp (the default provided by VS) and successfully deployed.

Updated:
You may need to disable loopback check if you are using hosts file for DNS routing. Please follow steps from http://support.microsoft.com/kb/896861 to disable loopback check.
You can find more details at http://msdn.microsoft.com/en-us/library/fp179923(v=office.15).aspx

That's it.

No comments:

Post a Comment