PageRenderTime 24ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tools/install.ps1

#
Powershell | 28 lines | 17 code | 6 blank | 5 comment | 2 complexity | 58df43ae6e6627e9f25522e4fe75a003 MD5 | raw file
  1. param($rootPath, $toolsPath, $package, $project)
  2. # Ensure that scaffolding works
  3. if (-not (Get-Command Invoke-Scaffolder)) { return }
  4. # The reason is issue (http://nuget.codeplex.com/workitem/595). Now we need to remove dummy file.
  5. if ($project) { $projectName = $project.Name }
  6. Get-ProjectItem "NuGetDymmy.txt" -Project $projectName | %{ $_.Delete() }
  7. Set-DefaultScaffolder -Name Model -Scaffolder ModelScaffolding.Model -SolutionWide -DoNotOverwriteExistingSetting
  8. $project.Object.References.Add("System.ComponentModel.DataAnnotations")
  9. # TODO: modify ".cs" when decide to support VB too
  10. # $lang = Get-ProjectLanguage
  11. # if ($lang -eq $null) { $lang = "cs" }
  12. Write-Host " "
  13. Write-Host "ModelScaffolding installed with dependencies and DataAnnotations reference."
  14. Write-Host " "
  15. Write-Host "You can generate your models using the following simple commands (without '//' comments):"
  16. Write-Host "PM> Scaffold Model MyModel // simplest MyModel.cs with Id, Name and annotations"
  17. Write-Host "PM> Scaffold Model MyModel -Folder Models -Force -NoAnnotations // simplest .\Models\MyModel.cs"
  18. Write-Host " "
  19. Write-Host "Also you can use more comprehensive commands with MVC Controllers and Views (just take a look at the output):"
  20. Write-Host "PM> Scaffold Model MyModel Id,Name,Test?,Count?,CreatedDate Models -Force "
  21. Write-Host " "
  22. Write-Host "Visit the http://modelscaffolding.codeplex.com/ to learn about output and conventions customization."