Created
July 14, 2014 19:32
-
-
Save xt0rted/e2d233385ee9f5cba3c0 to your computer and use it in GitHub Desktop.
Nancy.Viewengines.Razor.0.23.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($installPath, $toolsPath, $package, $project) | |
. (Join-Path $toolsPath "GetNancyRazorBuildProviderPostBuildCmd.ps1") | |
# Get the current Post Build Event cmd | |
$currentPostBuildCmd = $project.Properties.Item("PostBuildEvent").Value | |
# Append our post build command if it's not already there | |
if (!$currentPostBuildCmd.Contains($NancyRazorBuildProviderPostBuildCmd)) { | |
$project.Properties.Item("PostBuildEvent").Value += $NancyRazorBuildProviderPostBuildCmd | |
} | |
function Get-VsFileSystem { | |
$componentModel = Get-VSComponentModel | |
$fileSystemProvider = $componentModel.GetService([NuGet.VisualStudio.IFileSystemProvider]) | |
$solutionManager = $componentModel.GetService([NuGet.VisualStudio.ISolutionManager]) | |
$fileSystem = $fileSystemProvider.GetFileSystem($solutionManager.SolutionDirectory) | |
return $fileSystem | |
} | |
$projectRoot = $project.Properties.Item("FullPath").Value | |
if (!$projectRoot) { | |
return; | |
} | |
$destDirectory = $projectRoot | |
$fileSystem = Get-VsFileSystem | |
$file = Join-Path $installPath "content\web.config.transform" | |
ls $file -Filter *.transform | %{ | |
$destPath = Join-Path $destDirectory "web.config" | |
if (!(Test-Path $destPath)) { | |
$fileStream = $null | |
try { | |
$fileStream = [System.IO.File]::OpenRead($_.FullName) | |
$fileSystem.AddFile($destPath, $fileStream) | |
$project.ProjectItems.AddFromFile($destPath) | |
} catch { | |
# We don't want an exception to surface if we can't add the file for some reason | |
} finally { | |
if ($fileStream -ne $null) { | |
$fileStream.Dispose() | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($installPath, $toolsPath, $package, $project) | |
. (Join-Path $toolsPath "GetNancyRazorBuildProviderPostBuildCmd.ps1") | |
# Get the current Post Build Event cmd | |
$currentPostBuildCmd = $project.Properties.Item("PostBuildEvent").Value | |
# Remove our post build command from it (if it's there) | |
$project.Properties.Item("PostBuildEvent").Value = $currentPostBuildCmd.Replace($NancyRazorBuildProviderPostBuildCmd, "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment