Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .build.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param(
[ValidateSet("net451", "netstandard1.6")]
[ValidateSet("net451", "netstandard2.0")]
[string]$Framework = "net451",

[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
Expand All @@ -19,7 +19,7 @@ if ($BuildTask -eq "release") {
"net451" = @{
Configuration = @('Release', "PSV3Release")
}
"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
23 changes: 15 additions & 8 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,6 +48,14 @@
</EmbeddedResource>
</ItemGroup>

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

<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is really about full CLR should we still point at this? Would Microsoft.PowerShell.5.ReferenceAssemblies be better? (or Microsoft.PowerShell.3.ReferenceAssemblies) rather than pointing off to that alpha13 thing?

Copy link
Collaborator Author

@bergmeister bergmeister Apr 4, 2018

Choose a reason for hiding this comment

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

At the moment this PR changes it only for the coreclr but I can look into how to do it for full CLR. I first wanted to rather start with the simpler task but maybe it is better to do both in one go.

</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'PSV3Release' ">
<DefineConstants>$(DefineConstants);PSV3;PSV5</DefineConstants>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Engine/ScriptAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Exit
```
* PowerShell Core
```powershell
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
```
* Build documenatation
```powershell
Expand Down
27 changes: 15 additions & 12 deletions Rules/Rules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

<PropertyGroup>
<VersionPrefix>1.16.1</VersionPrefix>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules</AssemblyName>
<PackageId>Rules</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback)</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netstandard1.6' ">1.0.4</RuntimeFrameworkVersion>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(PackageTargetFallback)</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">1.0.4</RuntimeFrameworkVersion>
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Engine\Engine.csproj" />
</ItemGroup>

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

Expand All @@ -30,14 +26,10 @@
<DebugType>portable</DebugType>
</PropertyGroup>

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

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

<ItemGroup>
<Compile Update="Strings.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -53,6 +45,17 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Management.Automation" Version="6.0.1.1" />
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0-alpha08" />
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 a good example to show that the old System.Management.Automation package was self-contained and now we also need its other dependency Microsoft.Management.Infrastructure.

Copy link
Contributor

Choose a reason for hiding this comment

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

could this just be Version="1.0.0-alpha* (that's what it is in PowerShell repo)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I think it is reasonable to always take the latest version of a pre-release package.

<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
<Compile Remove="UseSingularNouns.cs" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'PSV3Release' ">
<DefineConstants>$(DefineConstants);PSV3;PSV5</DefineConstants>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Utils/ReleaseMaker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function New-ReleaseBuild
remove-item out/ -recurse -force
.\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV3Release -Build
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
.\build.ps1 -BuildDocs
}
finally
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build_script:
Write-Verbose ".NET SDK version: $(dotnet --version)" -Verbose
Push-Location C:\projects\psscriptanalyzer
# Test build using netstandard to test whether APIs are being called that are not available in .Net Core. Remove output afterwards.
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
git clean -dfx
C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build
C:\projects\psscriptanalyzer\build.ps1 -BuildDocs
Expand Down
8 changes: 4 additions & 4 deletions buildCoreClr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
[switch]$Uninstall,
[switch]$Install,

[ValidateSet("net451", "netstandard1.6")]
[string]$Framework = "netstandard1.6",
[ValidateSet("net451", "netstandard2.0")]
[string]$Framework = "netstandard2.0",

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

if ($Configuration -match "PSv3" -and $Framework -eq "netstandard1.6")
if ($Configuration -match "PSv3" -and $Framework -eq "netstandard2.0")
{
throw ("{0} configuration is not applicable to {1} framework" -f $Configuration,$Framework)
}
Expand All @@ -32,7 +32,7 @@ $itemsToCopyCommon = @("$solutionDir\Engine\PSScriptAnalyzer.psd1",

$destinationDir = "$solutionDir\out\PSScriptAnalyzer"
$destinationDirBinaries = $destinationDir
if ($Framework -eq "netstandard1.6")
if ($Framework -eq "netstandard2.0")
{
$destinationDirBinaries = "$destinationDir\coreclr"
}
Expand Down