Skip to content

Instantly share code, notes, and snippets.

@baywet
Created March 2, 2016 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baywet/ad41ccb8ad0bb12184ae to your computer and use it in GitHub Desktop.
Save baywet/ad41ccb8ad0bb12184ae to your computer and use it in GitHub Desktop.
This file will allow you to run the db update for a dnx project from powershell
param([string]$connectionString)
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
if($globalJson)
{
$dnxVersion = $globalJson.sdk.version
}
else
{
Write-Warning "Unable to locate global.json to determine using 'latest'"
$dnxVersion = "latest"
}
# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
$Env:UpdateConnectionString = $connectionString
& dnx -p ".\src\NameOfTheProjectWithDbContext\" ef database update -v -e update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment