Skip to content

Commit

Permalink
Merge pull request #121 from webmd-health-services/bugfix/web-adminis…
Browse files Browse the repository at this point in the history
…tration-not-imported-pscore

2.11.3
  • Loading branch information
splatteredbits authored Jun 29, 2022
2 parents 43337a4 + 0be0679 commit 95a3348
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/Carbon/bin/coreclr
/Carbon/bin/fullclr
/Carbon/*.md
**/obj/**
**/.vs/**
Source/**/bin/**
Expand Down Expand Up @@ -27,4 +28,5 @@ Carbon/LICENSE.txt
Carbon/NOTICE.txt
*.orig
/.vscode/**
/.dotnet*
/.dotnet*
/global.json
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

# 2.11.3

* Fixed: Carbon doesn't load Microsoft.Web.Administration assembly on PowerShell 7+.


# 2.11.2

* Fixed: `Carbon.Firewall.Rule` type missing the `LocalIP` and `RemoteIP` properties (which are aliases for the
Expand Down
2 changes: 1 addition & 1 deletion Carbon/Carbon.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
RootModule = 'Carbon.psm1'

# Version number of this module.
ModuleVersion = '2.11.2'
ModuleVersion = '2.11.3'

# ID used to uniquely identify this module
GUID = '075d9444-c01b-48c3-889a-0b3490716fa2'
Expand Down
29 changes: 19 additions & 10 deletions Carbon/Carbon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ function Add-CAssembly
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[String] $Path
[String] $Path,

[switch] $PassThru
)

$numErrors = $Global:Error.Count
try
{
Add-Type -Path $Path
if( $PassThru )
{
return $true
}
}
catch
{
Expand All @@ -68,11 +74,16 @@ function Add-CAssembly
{
$Global:Error.RemoveAt(0)
}
if( $PassThru )
{
return $false
}
}
}

Write-Timing ('Loading Carbon assemblies from "{0}".' -f $carbonAssemblyDir)
Get-ChildItem -Path (Join-Path -Path $carbonAssemblyDir -ChildPath '*') -Filter 'Carbon*.dll' -Exclude 'Carbon.Iis.dll' |
$carbonAssembliesPath = Join-Path -Path $carbonAssemblyDir -ChildPath '*'
Get-ChildItem -Path $carbonAssembliesPath -Filter 'Carbon*.dll' -Exclude 'Carbon.Iis.dll' |
ForEach-Object { Add-CAssembly -Path $_.FullName }

# Active Directory
Expand All @@ -90,14 +101,12 @@ if( (Test-Path -Path 'env:SystemRoot') )
if( -not (Test-Path -Path 'env:CARBON_SKIP_IIS_IMPORT') -and `
(Test-Path -Path $microsoftWebAdministrationPath -PathType Leaf) )
{
$exportIisFunctions = $true
if( -not $IsPSCore )
{
Write-Timing ('Adding Microsoft.Web.Administration assembly.')
Add-CAssembly -Path $microsoftWebAdministrationPath
Write-Timing ('Adding Carbon.Iis assembly.')
Add-CAssembly -Path (Join-Path -Path $carbonAssemblyDir -ChildPath 'Carbon.Iis.dll' -Resolve)
}
Write-Timing ('Adding Microsoft.Web.Administration assembly.')
$webAdministrationLoaded = Add-CAssembly -Path $microsoftWebAdministrationPath -PassThru
Write-Timing ('Adding Carbon.Iis assembly.')
$carbonIisAssemblyPath = Join-Path -Path $carbonAssemblyDir -ChildPath 'Carbon.Iis.dll' -Resolve
$carbonIisLoaded = Add-CAssembly -Path $carbonIisAssemblyPath -PassThru
$exportIisFunctions = ($webAdministrationLoaded -and $carbonIisLoaded)
}
}

Expand Down
46 changes: 43 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ environment:
# job_group: ps
# appveyor_build_worker_image: Visual Studio 2022

# TODO: Get build working on a new version of the .NET SDK
# TODO: Get build working on a new version of the .NET SDK.
# - job_name: Windows Server 2019, PowerShell 7
# job_group: pwsh
# appveyor_build_worker_image: Visual Studio 2022
Expand All @@ -72,11 +72,51 @@ for:
only:
- job_group: ps
build_script:
- ps: .\build.ps1
- ps: |
if( -not (Get-Module -Name 'PowerShellGet' -ListAvailable | Where-Object Version -eq ([Version]'2.2.5')) )
{
$job = Start-Job {
Install-Module -Name 'PowerShellGet' -RequiredVersion '2.2.5' -AllowClobber -Force -Scope CurrentUser
}
$job | Wait-Job
$job | Receive-Job
$job | Remove-Job
}
if( -not (Get-Module -Name 'PackageManagement' -ListAvailable | Where-Object Version -eq ([Version]'1.4.7')) )
{
$job = Start-Job {
Install-Module -Name 'PackageManagement' -RequiredVersion '1.4.7' -AllowClobber -Force -Scope CurrentUser
}
$job | Wait-Job
$job | Receive-Job
$job | Remove-Job
}
Get-Module 'PowerShellGet', 'PackageManagement' -ListAvailable | Format-Table -Auto
.\build.ps1
# Build in PowerShell
- matrix:
only:
- job_group: pwsh
build_script:
- pwsh: ./build.ps1
- pwsh: |
if( -not (Get-Module -Name 'PowerShellGet' -ListAvailable | Where-Object Version -eq ([Version]'2.2.5')) )
{
$job = Start-Job {
Install-Module -Name 'PowerShellGet' -RequiredVersion '2.2.5' -AllowClobber -Force -Scope CurrentUser
}
$job | Wait-Job
$job | Receive-Job
$job | Remove-Job
}
if( -not (Get-Module -Name 'PackageManagement' -ListAvailable | Where-Object Version -eq ([Version]'1.4.7')) )
{
$job = Start-Job {
Install-Module -Name 'PackageManagement' -RequiredVersion '1.4.7' -AllowClobber -Force -Scope CurrentUser
}
$job | Wait-Job
$job | Receive-Job
$job | Remove-Job
}
Get-Module 'PowerShellGet', 'PackageManagement' -ListAvailable | Format-Table -Auto
./build.ps1
5 changes: 0 additions & 5 deletions global.json

This file was deleted.

4 changes: 3 additions & 1 deletion whiskey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Build:
- Exec:
OnlyBy: BuildServer
Path: appveyor
Argument: [ UpdateBuild, -Version, $(WHISKEY_SEMVER2) ]
Argument: [ UpdateBuild, -Version, "$(WHISKEY_SEMVER2)+$(WHISKEY_BUILD_NUMBER)" ]
- PowerShell:
OnlyBy: BuildServer
Path: Save-CarbonSigningKey.ps1
Expand Down Expand Up @@ -104,6 +104,8 @@ Build:
Name: Tests

PublishBin:
- Delete:
Path: global.json
- MSBuild:
Path:
- Source\Carbon.csproj
Expand Down

0 comments on commit 95a3348

Please sign in to comment.