FrameworkTemplate/Solutions/Scripts/GenerateTypes.ps1

Write-Host("Cleaning up Context Files...")
######################## SETUP
. ".\_SetupTools.ps1"
. ".\_Config.ps1"

Remove-Item ..\..\Entities\Context -Force -Recurse -ErrorAction Ignore
Remove-Item ..\..\WebResources\typings\XRM -Force -Recurse -ErrorAction Ignore

New-Item -ItemType Directory -Path ..\..\Entities\Context
New-Item -ItemType Directory -Path ..\..\WebResources\typings\XRM

if (!$Credentials) {
    $message = "Getting Credentials for $global:ServerUrl"
    Write-Host $message
  
    $Credentials = Get-Credential -Message "Credentials : $global:SolutionName @ $global:ServerUrl"
  }
  if (!$UserName)
  {
  $UserName =  $Credentials.GetNetworkCredential().UserName
  $Password =  $Credentials.GetNetworkCredential().Password
  }
..\XrmContext\XrmContext.exe /url:$global:ServerUrl/XRMServices/2011/Organization.svc /username:$UserName /password:$Password /useconfig /out:"../../Entities/Context"
..\XrmDefinitelyTyped\XrmDefinitelyTyped.exe /url:$global:ServerUrl/XRMServices/2011/Organization.svc /username:$UserName /password:$Password /useconfig /out:"../../Webresources/typings/XRM" /jsLib:"../../Webresources/src/library"