Skip to content

Upgrade 'System.Automation.Management' NuGet package of version 6.0.0-alpha13 to official version 6.0.2 from powershell-core feed, which requires upgrade to netstandard2.0 #919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a17699b
Upgrade system.automation.management to 6.0.1.1 for netstandard, whic…
bergmeister Mar 3, 2018
a48573c
use release version of TypeExtensions instead of pre-release
bergmeister Mar 3, 2018
83fcb7b
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister Mar 23, 2018
7403578
Update System.Management.Automation from 6.0.1.1 to 6.0.2
bergmeister Mar 23, 2018
81bdc15
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister Mar 30, 2018
511216c
run PowerShell Core tests only if image has at least 6.0.2 as require…
bergmeister Apr 3, 2018
4767772
install pwsh for windows if required instead of skipping tests. Thank…
bergmeister Apr 4, 2018
52d8521
upgrade to net 461 and use in full clr as well
bergmeister Apr 4, 2018
d31a55b
fix other references to net451 with net461
bergmeister Apr 4, 2018
041c2a2
Revert "fix other references to net451 with net461"
bergmeister Apr 4, 2018
5e73dd9
Revert "upgrade to net 461 and use in full clr as well"
bergmeister Apr 4, 2018
e59178c
use v3/5 reference assemblies
bergmeister Apr 4, 2018
09b8822
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister Apr 4, 2018
5bb6fed
Make UseIdenticalMandatoryParametersDSC rule compilable for v4 by int…
bergmeister Apr 4, 2018
c13f87b
fix wmf4 build
bergmeister Apr 4, 2018
0c59367
Use 1.0.0-alpha* of Microsoft.Management.Infrastructure nuget package…
bergmeister Apr 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .build.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
param(
[ValidateSet("net451", "netstandard1.6")]
[ValidateSet("net451", "netstandard2.0")]
[string]$Framework = "net451",

[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release", "PSv4Release")]
[string]$Configuration = "Debug"
)

Expand All @@ -17,9 +17,9 @@ if ($BuildTask -eq "release") {
$buildData = @{
Frameworks = @{
"net451" = @{
Configuration = @('Release', "PSV3Release")
Configuration = @('Release', "PSV3Release", "PSv4Release")
}
"netstandard1.6" = @{
"netstandard2.0" = @{
Configuration = @('Release')
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ task createModule {
$itemsToCopyBinaries = @("$solutionDir\Engine\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll",
"$solutionDir\Rules\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll")

if ($Framework -eq "netstandard1.6") {
if ($Framework -eq "netstandard2.0") {
$destinationDirBinaries = "$destinationDir\coreclr"
}
elseif ($Configuration -match 'PSv3') {
Expand Down
37 changes: 28 additions & 9 deletions Engine/Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@

<PropertyGroup>
<VersionPrefix>1.16.1</VersionPrefix>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer</AssemblyName>
<PackageId>Engine</PackageId>
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<Compile Remove="SafeDirectoryCatalog.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Commands\GetScriptAnalyzerLoggerCommand.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
</ItemGroup>

<ItemGroup>
<Compile Update="Strings.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -49,8 +48,28 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Management.Automation" Version="6.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net451' AND '$(Configuration)' == 'PSV3Release' AND '$(Configuration)' != 'PSV4Release'">
<PackageReference Include="Microsoft.PowerShell.3.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net451' AND '$(Configuration)' == 'PSV4Release'">
<PackageReference Include="Microsoft.PowerShell.4.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net451' AND '$(Configuration)' != 'PSV3Release'">
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'PSV3Release' ">
<DefineConstants>$(DefineConstants);PSV3;PSV5</DefineConstants>
<DefineConstants>$(DefineConstants);PSV3</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'PSV4Release' ">
<DefineConstants>$(DefineConstants);PSV3;PSV4</DefineConstants>
</PropertyGroup>

</Project>
5 changes: 4 additions & 1 deletion Engine/PSScriptAnalyzer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'
}
else {
if ($PSVersionTable.PSVersion -lt [Version]'5.0') {
if ($PSVersionTable.PSVersion.Major -eq 3) {
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv3'
}
elseif ($PSVersionTable.PSVersion.Major -eq 4) {
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv4'
}
}

$binaryModulePath = Join-Path -Path $binaryModuleRoot -ChildPath 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll'
Expand Down
2 changes: 1 addition & 1 deletion Engine/ScriptAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ private List<ExternalRule> GetExternalRule(string[] moduleNames)
{
dynamic description = helpContent[0].Properties["Description"];

if (null != description && null != description.Value && description.Value.GetType().IsArray)
if (description != null && description.Value != null && description.Value.GetType().IsArray)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to highlight why I needed the NuGet package for Microsoft.CSharp, which was included in netstandard1.6 but not netstandard2.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup - I found this as well when I was looking at building against PowerShellStandard.Library

{
desc = description.Value[0].Text;
}
Expand Down
174 changes: 0 additions & 174 deletions Engine/ScriptAnalyzerEngine.csproj

This file was deleted.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,17 @@ Exit
```powershell
.\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build
```
* Windows PowerShell version 3.0 and 4.0
* Windows PowerShell version 4.0
```powershell
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV4Release -Build
```
* Windows PowerShell version 3.0
```powershell
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV3Release -Build
```
* PowerShell Core
```powershell
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
```
* Build documenatation
```powershell
Expand Down
Loading