Skip to content

Instantly share code, notes, and snippets.

function CheckConfig($WebPath)
{
$src = $WebPath + "Web.config"
$xdt = $WebPath + "Web.Azure-QA.config"
$temp = $WebPath + "Web.Temp.config"
Add-Type -Path "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.XmlTransform.dll"
try
{
$doc = New-Object Microsoft.Web.XmlTransform.XmlTransformableDocument
@renzors
renzors / generate_nuget.ps1
Created January 30, 2017 16:46
Generate nuget and push to octopus
#vcsName: Only if you have two VCS or more, but it run you must set checkout rule +:.=> [vcsName] in VCS
$vcsName = "Main"
$webPath = "%teamcity.build.checkoutDir%/$vcsName"
#nugetVersion: Generate based on release name and build counter
$nugetVersion = "%env.nuget_version%"
$nugetId = "%octo.ProjectName%.$vcsName"
$octopusNugetRepo = "%OctopusNugetRepo%"
$octopusApiKey = "%OctopusApiKey%"
function GenerateWebNugets{
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$sm = New-Object Microsoft.Web.Administration.ServerManager
foreach($site in $sm.Sites)
{
$root = $site.Applications | where { $_.Path -eq "/" }
Write-Output ("Site: " + $site.Name + " | Pool: " + $root.ApplicationPoolName)
}
Import-Module Webadministration
Get-ChildItem -Path IIS:\Sites
function CheckConfig($WebPath)
{
$src = $WebPath + "Web.config"
$xdt = $WebPath + "Web.PROD.config"
$temp = $WebPath + "Web.Temp.config"
Add-Type -Path "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.XmlTransform.dll"
try
{
$doc = New-Object Microsoft.Web.XmlTransform.XmlTransformableDocument
$configFile = "D:\test\web.config"
[xml]$xml = Get-Content $configFile
$compilationAttrib = $xml.configuration.'system.web'.compilation.debug
if($compilationAttrib -eq "true"){
Write-Error "Error: The debug compilation must not be true"
}
else {