From ebfd39abcf2ba607c5935dc739bf3067da934cab Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 00:04:19 +0000 Subject: [PATCH 01/32] Upgrade to .Net Core SDK 1.1.5 --- Engine/Engine.csproj | 41 +++++++++++++++++++++++++++ Engine/project.json | 54 ------------------------------------ README.md | 7 ++++- Rules/Rules.csproj | 48 ++++++++++++++++++++++++++++++++ Rules/project.json | 61 ----------------------------------------- Utils/ReleaseMaker.psm1 | 4 +-- appveyor.yml | 4 --- buildCoreClr.ps1 | 6 ++-- global.json | 2 +- 9 files changed, 101 insertions(+), 126 deletions(-) create mode 100644 Engine/Engine.csproj delete mode 100644 Engine/project.json create mode 100644 Rules/Rules.csproj delete mode 100644 Rules/project.json diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj new file mode 100644 index 000000000..864a35689 --- /dev/null +++ b/Engine/Engine.csproj @@ -0,0 +1,41 @@ + + + + 1.16.1 + net451;netstandard1.6 + Microsoft.Windows.PowerShell.ScriptAnalyzer + Engine + $(PackageTargetFallback);dnxcore50 + + + + + + + + + + + + + + portable + + + + + + + + $(DefineConstants);CORECLR + + + + + + + + $(DefineConstants);PSV3;PSV5 + + + diff --git a/Engine/project.json b/Engine/project.json deleted file mode 100644 index 620ade237..000000000 --- a/Engine/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "Microsoft.Windows.PowerShell.ScriptAnalyzer", - "version": "1.16.1", - "dependencies": { -"System.Management.Automation": "6.0.0-alpha13" - }, - - "configurations": { - "PSV3Release": { - "buildOptions": { - "define": [ "PSV3", "PSV5" ], - "optimize": true - } - }, - "PSV3Debug": { - "buildOptions": { - "define": [ "PSV3", "DEBUG" ] - } - } - }, - - "frameworks": { - "net451": { - "frameworkAssemblies": { - "System.ComponentModel.Composition": "" - }, - "buildOptions": { - "compile": { - "exclude": [ - "Commands/GetScriptAnalyzerLoggerCommand.cs", - "Strings.Designer.Core.cs", - "Strings.Designer.cs" - ] - }, - "debugType": "portable" - } - }, - "netstandard1.6": { - "imports": "dnxcore50", - "buildOptions": { - "define": [ "CORECLR" ], - "compile": { - "exclude": [ - "SafeDirectoryCatalog.cs", - "Strings.Designer.cs", - "Strings.Designer.Core.cs", - "Commands/GetScriptAnalyzerLoggerCommand.cs" - ] - }, - "debugType": "portable" - } - } - } -} diff --git a/README.md b/README.md index b532a5c7b..22d3a445d 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,12 @@ Exit ``` * Restore packages ```powershell - dotnet restore + pushd .\Engine + dotnet restore Engine.csproj + popd + pushd Rules + dotnet restore Rules.csproj + popd ``` * Build for your platform * Windows PowerShell version 5.0 and greater diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj new file mode 100644 index 000000000..fd287823e --- /dev/null +++ b/Rules/Rules.csproj @@ -0,0 +1,48 @@ + + + + 1.16.1 + net451;netstandard1.6 + Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules + Rules + $(PackageTargetFallback);dnxcore50 + 1.0.4 + + + + + + + + + + + + + + + + + + + + portable + + + + + + + + $(DefineConstants);CORECLR + + + + + + + + $(DefineConstants);PSV3;PSV5 + + + diff --git a/Rules/project.json b/Rules/project.json deleted file mode 100644 index 6a37f6f04..000000000 --- a/Rules/project.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules", - "version": "1.16.1", - "dependencies": { - "System.Management.Automation": "6.0.0-alpha13", - "Engine": "1.16.1", - "Newtonsoft.Json": "9.0.1" - }, - - "configurations": { - "PSV3Release": { - "buildOptions": { - "define": [ "PSV3", "PSV5" ], - "optimize": true - } - }, - "PSV3Debug": { - "buildOptions": { - "define": [ "PSV3", "DEBUG" ] - } - } - }, - - "frameworks": { - "net451": { - "frameworkAssemblies": { - "System.ComponentModel.Composition": "", - "System.Data.Entity.Design": "" - }, - "buildOptions": { - "compile": { - "exclude": [ - "Strings.Designer.Core.cs", - "Strings.Designer.cs" - ] - }, - "debugType": "portable" - } - }, - "netstandard1.6": { - "imports": "dnxcore50", - "buildOptions": { - "define": [ "CORECLR" ], - "compile": { - "exclude": [ - "Strings.Designer.cs", - "Strings.Designer.Core.cs", - "UseSingularNouns.cs" - ] - }, - "debugType": "portable" - }, - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0-rc2-3002702" - } - } - } - } -} diff --git a/Utils/ReleaseMaker.psm1 b/Utils/ReleaseMaker.psm1 index 9d2dffcb9..da33bfac9 100644 --- a/Utils/ReleaseMaker.psm1 +++ b/Utils/ReleaseMaker.psm1 @@ -171,8 +171,8 @@ function Update-Version [string] $solutionPath ) - $ruleJson = Combine-Path $solutionPath 'Rules' 'project.json' - $engineJson = Combine-Path $solutionPath 'Engine' 'project.json' + $ruleJson = Combine-Path $solutionPath 'Rules' 'Rules.csproj' + $engineJson = Combine-Path $solutionPath 'Engine' 'Engine.csproj' $pssaManifest = Combine-Path $solutionPath 'Engine' 'PSScriptAnalyzer.psd1' Update-PatternInFile $ruleJson '"version": "{0}"' $oldVer $newVer diff --git a/appveyor.yml b/appveyor.yml index 1e24d0dea..057641dd0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,10 +10,6 @@ environment: # clone directory clone_folder: c:\projects\psscriptanalyzer -# cache nuget packages -cache: - - '%USERPROFILE%\.nuget\packages -> **\project.json' - # Install Pester install: - cinst -y pester --version 3.4.0 diff --git a/buildCoreClr.ps1 b/buildCoreClr.ps1 index f3111380f..89aef4081 100644 --- a/buildCoreClr.ps1 +++ b/buildCoreClr.ps1 @@ -20,7 +20,7 @@ Function Test-DotNetRestore param( [string] $projectPath ) - Test-Path (Join-Path $projectPath 'project.lock.json') + Test-Path ([System.IO.Path]::Combine($projectPath, 'obj', 'project.assets.json')) } $solutionDir = Split-Path $MyInvocation.InvocationName @@ -57,7 +57,7 @@ if ($build) } .\New-StronglyTypedCsFileForResx.ps1 Engine Push-Location Engine\ - dotnet build --framework $Framework --configuration $Configuration + dotnet build Engine.csproj --framework $Framework --configuration $Configuration Pop-Location @@ -67,7 +67,7 @@ if ($build) } .\New-StronglyTypedCsFileForResx.ps1 Rules Push-Location Rules\ - dotnet build --framework $Framework --configuration $Configuration + dotnet build Rules.csproj --framework $Framework --configuration $Configuration Pop-Location Function CopyToDestinationDir($itemsToCopy, $destination) diff --git a/global.json b/global.json index 023d5575d..a7d00c0aa 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "Rules" ], "sdk": { - "version": "1.0.0-preview2-1-003177" + "version": "1.1.5" } } From 647b40f81ba8dda2c79df4c1f3b25a5833f4c0cd Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 00:15:56 +0000 Subject: [PATCH 02/32] fix restore --- appveyor.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 057641dd0..8f0fb9228 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,13 @@ build_script: - ps: | $PSVersionTable Push-Location C:\projects\psscriptanalyzer - dotnet restore + dotnet --version + pushd .\Engine + dotnet restore Engine.csproj + popd + pushd Rules + dotnet restore Rules.csproj + popd C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build C:\projects\psscriptanalyzer\build.ps1 -BuildDocs Pop-Location From 0e49065429252e45e80198e074101aa173850f77 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 00:22:51 +0000 Subject: [PATCH 03/32] use newer vs 2017 image instead of wmf5 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8f0fb9228..29bcfbb35 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: WMF 5 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 PowerShellEdition: Desktop BuildConfiguration: Release - APPVEYOR_BUILD_WORKER_IMAGE: WMF 4 From 1afcaa7a19b727075f45ed4726fdbd5e44788890 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 00:26:00 +0000 Subject: [PATCH 04/32] do not install pester for new image because it is already installed --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 29bcfbb35..038e90209 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,6 @@ clone_folder: c:\projects\psscriptanalyzer # Install Pester install: - - cinst -y pester --version 3.4.0 - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion build_script: From a14aef3cb6ecbd74e88beff361934213840adaaf Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 19:05:59 +0000 Subject: [PATCH 05/32] replace project.json reference with new csproj in build.ps1 --- .build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.build.ps1 b/.build.ps1 index a712753bf..79ca9eecb 100644 --- a/.build.ps1 +++ b/.build.ps1 @@ -81,8 +81,8 @@ function Get-BuildTaskParams($project) { function Get-RestoreTaskParams($project) { @{ - Inputs = "$BuildRoot/$project/project.json" - Outputs = "$BuildRoot/$project/project.lock.json" + Inputs = "$BuildRoot/$project/$project.csproj" + Outputs = "$BuildRoot/$project/$project.csproj" Jobs = {dotnet restore} } } From 46ba6cc42440bf84d2158fa88e269bd1bbcfb0ac Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 Dec 2017 23:51:33 +0000 Subject: [PATCH 06/32] Fix problem with ressource binding --- Engine/Engine.csproj | 26 ++- Engine/Strings.Designer.cs | 245 +++++++++++++++++++- New-StronglyTypedCsFileForResx.ps1 | 4 +- PSScriptAnalyzerNetCore.sln | 51 +++++ Rules/Rules.csproj | 22 +- Rules/Strings.Designer.cs | 346 ++++++++++++++++++++++++++++- buildCoreClr.ps1 | 4 +- 7 files changed, 673 insertions(+), 25 deletions(-) create mode 100644 PSScriptAnalyzerNetCore.sln diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj index 864a35689..f434cfefb 100644 --- a/Engine/Engine.csproj +++ b/Engine/Engine.csproj @@ -6,6 +6,7 @@ Microsoft.Windows.PowerShell.ScriptAnalyzer Engine $(PackageTargetFallback);dnxcore50 + Microsoft.Windows.PowerShell.ScriptAnalyzer @@ -22,16 +23,31 @@ portable - - - - $(DefineConstants);CORECLR - + + + + + + + + + + True + True + Strings.resx + + + + + + ResXFileCodeGenerator + Strings.Designer.cs + diff --git a/Engine/Strings.Designer.cs b/Engine/Strings.Designer.cs index 7af798344..210fe571c 100644 --- a/Engine/Strings.Designer.cs +++ b/Engine/Strings.Designer.cs @@ -10,8 +10,9 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { using System; - - + using System.Reflection; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,7 +20,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Strings { @@ -39,7 +40,7 @@ internal Strings() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Windows.PowerShell.ScriptAnalyzer.Strings", typeof(Strings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Windows.PowerShell.ScriptAnalyzer.Strings", typeof(Strings).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; @@ -87,6 +88,33 @@ internal static string CommandInfoNotFound { } } + /// + /// Looks up a localized string similar to "Argument should not be null.".. + /// + internal static string ConfigurableScriptRuleNRE { + get { + return ResourceManager.GetString("ConfigurableScriptRuleNRE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "Cannot find a ConfigurableRuleProperty attribute on property {0}".. + /// + internal static string ConfigurableScriptRulePropertyHasNotAttribute { + get { + return ResourceManager.GetString("ConfigurableScriptRulePropertyHasNotAttribute", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SettingsFileHasInvalidHashtable. + /// + internal static string ConfigurationFileHasInvalidHashtable { + get { + return ResourceManager.GetString("ConfigurationFileHasInvalidHashtable", resourceCulture); + } + } + /// /// Looks up a localized string similar to SettingsFileHasNoHashTable. /// @@ -150,6 +178,51 @@ internal static string DefaultLoggerName { } } + /// + /// Looks up a localized string similar to Edge from {0} to {1} already exists.. + /// + internal static string DigraphEdgeAlreadyExists { + get { + return ResourceManager.GetString("DigraphEdgeAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vertex {0} already exists! Cannot add it to the digraph.. + /// + internal static string DigraphVertexAlreadyExists { + get { + return ResourceManager.GetString("DigraphVertexAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vertex {0} does not exist in the digraph.. + /// + internal static string DigraphVertexDoesNotExists { + get { + return ResourceManager.GetString("DigraphVertexDoesNotExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot determine line endings as the text probably contain mixed line endings.. + /// + internal static string EditableTextInvalidLineEnding { + get { + return ResourceManager.GetString("EditableTextInvalidLineEnding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to TextEdit extent not completely contained in EditableText.. + /// + internal static string EditableTextRangeIsNotContained { + get { + return ResourceManager.GetString("EditableTextRangeIsNotContained", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot find file '{0}'.. /// @@ -204,6 +277,15 @@ internal static string MissingRuleExtension { } } + /// + /// Looks up a localized string similar to Temporary module location: {0}.. + /// + internal static string ModuleDepHandlerTempLocation { + get { + return ResourceManager.GetString("ModuleDepHandlerTempLocation", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} cannot be set by both positional and named arguments.. /// @@ -267,6 +349,51 @@ internal static string ParserErrorMessageForScriptDefinition { } } + /// + /// Looks up a localized string similar to Column number cannot be less than 1.. + /// + internal static string PositionColumnLessThanOne { + get { + return ResourceManager.GetString("PositionColumnLessThanOne", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Line number cannot be less than 1.. + /// + internal static string PositionLineLessThanOne { + get { + return ResourceManager.GetString("PositionLineLessThanOne", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Input position should be less than that of the invoking object.. + /// + internal static string PositionRefPosLessThanInputPos { + get { + return ResourceManager.GetString("PositionRefPosLessThanInputPos", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reference Position should begin before start Position of Range.. + /// + internal static string RangeRefPosShouldStartBeforeRangeStartPos { + get { + return ResourceManager.GetString("RangeRefPosShouldStartBeforeRangeStartPos", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start position cannot be before End position.. + /// + internal static string RangeStartPosGreaterThanEndPos { + get { + return ResourceManager.GetString("RangeStartPosGreaterThanEndPos", resourceCulture); + } + } + /// /// Looks up a localized string similar to RULE_ERROR. /// @@ -321,6 +448,96 @@ internal static string RuleSuppressionRuleNameNotFound { } } + /// + /// Looks up a localized string similar to Found {0}. Will use it to provide settings for this invocation.. + /// + internal static string SettingsAutoDiscovered { + get { + return ResourceManager.GetString("SettingsAutoDiscovered", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find a settings file.. + /// + internal static string SettingsCannotFindFile { + get { + return ResourceManager.GetString("SettingsCannotFindFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dictionary should be indexable in a case-insensitive manner.. + /// + internal static string SettingsDictionaryShouldBeCaseInsesitive { + get { + return ResourceManager.GetString("SettingsDictionaryShouldBeCaseInsesitive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Input should be a dictionary type.. + /// + internal static string SettingsInputShouldBeDictionary { + get { + return ResourceManager.GetString("SettingsInputShouldBeDictionary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Settings should be either a file path, built-in preset or a hashtable.. + /// + internal static string SettingsInvalidType { + get { + return ResourceManager.GetString("SettingsInvalidType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot parse settings. Will abort the invocation.. + /// + internal static string SettingsNotParsable { + get { + return ResourceManager.GetString("SettingsNotParsable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Settings not provided. Will look for settings file in the given path {0}.. + /// + internal static string SettingsNotProvided { + get { + return ResourceManager.GetString("SettingsNotProvided", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Using settings file at {0}.. + /// + internal static string SettingsUsingFile { + get { + return ResourceManager.GetString("SettingsUsingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Using settings hashtable.. + /// + internal static string SettingsUsingHashtable { + get { + return ResourceManager.GetString("SettingsUsingHashtable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} property must be of type bool.. + /// + internal static string SettingsValueTypeMustBeBool { + get { + return ResourceManager.GetString("SettingsValueTypeMustBeBool", resourceCulture); + } + } + /// /// Looks up a localized string similar to All the arguments of the Suppress Message Attribute should be string constants.. /// @@ -348,6 +565,24 @@ internal static string TargetWithoutScopeSuppressionAttributeError { } } + /// + /// Looks up a localized string similar to Line element cannot be null.. + /// + internal static string TextEditNoNullItem { + get { + return ResourceManager.GetString("TextEditNoNullItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Line element cannot be null.. + /// + internal static string TextLinesNoNullItem { + get { + return ResourceManager.GetString("TextLinesNoNullItem", resourceCulture); + } + } + /// /// Looks up a localized string similar to Analyzing file: {0}. /// @@ -430,7 +665,7 @@ internal static string WrongValueFormat { } /// - /// Looks up a localized string similar to Value {0} for key {1} has the wrong data type. Value in the settings hashtable should be a string or an array of strings.. + /// Looks up a localized string similar to Value {0} for key {1} has the wrong data type.. /// internal static string WrongValueHashTable { get { diff --git a/New-StronglyTypedCsFileForResx.ps1 b/New-StronglyTypedCsFileForResx.ps1 index c18896f66..41def3be5 100644 --- a/New-StronglyTypedCsFileForResx.ps1 +++ b/New-StronglyTypedCsFileForResx.ps1 @@ -26,7 +26,7 @@ function Get-StronglyTypeCsFileForResx $banner = @' //------------------------------------------------------------------------------ // -// This code was generated by a New-StronglyTypedCsFileForResx funciton. +// This code was generated by a New-StronglyTypedCsFileForResx function. // To add or remove a member, edit your .ResX file then rerun Start-ResGen. // // Changes to this file may cause incorrect behavior and will be lost if @@ -50,7 +50,7 @@ using System.Reflection; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// -[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] +[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/PSScriptAnalyzerNetCore.sln b/PSScriptAnalyzerNetCore.sln new file mode 100644 index 000000000..6b7e04454 --- /dev/null +++ b/PSScriptAnalyzerNetCore.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Engine", "Engine\Engine.csproj", "{E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rules", "Rules\Rules.csproj", "{D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.Build.0 = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.Build.0 = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8354D5F1-95D7-48B3-B4BF-DD7AACDAA5BA} + EndGlobalSection +EndGlobal diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj index fd287823e..e9dc3644e 100644 --- a/Rules/Rules.csproj +++ b/Rules/Rules.csproj @@ -7,6 +7,7 @@ Rules $(PackageTargetFallback);dnxcore50 1.0.4 + Microsoft.Windows.PowerShell.ScriptAnalyzer From 6312e12a26efb2a2850ab16d718c98aee2c95848 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 00:22:50 +0000 Subject: [PATCH 08/32] install .net sdk 1.1 for legacy wmf4 image --- appveyor.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 038e90209..321d251ca 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,14 @@ clone_folder: c:\projects\psscriptanalyzer # Install Pester install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion + - ps: | + # the legacy WMF4 image only has the old preview SDKs of dotnet + if (-not ((dotnet --version).StartsWith('1.1')) + { + Import-Module BitsTransfer + Start-BitsTransfer -Source https://dot.net/v1/dotnet-install.ps1 -Destination dotnet-install.ps1 + .\dotnet-install.ps1 -Version 1.1 + } build_script: - ps: | From 0af69eaa2506dfbb685e990782961f50ddc320cd Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 00:24:13 +0000 Subject: [PATCH 09/32] add missing parenthesis --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 321d251ca..28ee67b48 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet - if (-not ((dotnet --version).StartsWith('1.1')) + if (-not ((dotnet --version).StartsWith('1.1'))) { Import-Module BitsTransfer Start-BitsTransfer -Source https://dot.net/v1/dotnet-install.ps1 -Destination dotnet-install.ps1 From 4b25140fa8a87e2b052f922f4cdb22d2eda08dd6 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 00:39:51 +0000 Subject: [PATCH 10/32] use iwr instead of bitstransfer for wmf4 build due to mixed assembly mode and do not use aliases any more --- appveyor.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 28ee67b48..c4dd04bbf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,8 +17,7 @@ install: # the legacy WMF4 image only has the old preview SDKs of dotnet if (-not ((dotnet --version).StartsWith('1.1'))) { - Import-Module BitsTransfer - Start-BitsTransfer -Source https://dot.net/v1/dotnet-install.ps1 -Destination dotnet-install.ps1 + Invoke-WebRequest -BasicParsing https://dot.net/v1/dotnet-install.ps1 -Destination dotnet-install.ps1 .\dotnet-install.ps1 -Version 1.1 } @@ -27,12 +26,12 @@ build_script: $PSVersionTable Push-Location C:\projects\psscriptanalyzer dotnet --version - pushd .\Engine - dotnet restore Engine.csproj - popd - pushd Rules - dotnet restore Rules.csproj - popd + Push-Location .\Engine + dotnet restore Engine.csproj | Out-Null + Pop-Location + Push-Location Rules + dotnet restore Rules.csproj | Out-Null + Pop-Location C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build C:\projects\psscriptanalyzer\build.ps1 -BuildDocs Pop-Location From d9fb6bd45664d36a63bbd275c0f75f44c19aabba Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 01:13:50 +0000 Subject: [PATCH 11/32] Update appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c4dd04bbf..65520e85e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ install: # the legacy WMF4 image only has the old preview SDKs of dotnet if (-not ((dotnet --version).StartsWith('1.1'))) { - Invoke-WebRequest -BasicParsing https://dot.net/v1/dotnet-install.ps1 -Destination dotnet-install.ps1 + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing .\dotnet-install.ps1 -Version 1.1 } From 870ecde61ddabc0f5fd9f5f73b6ef147c24516de Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 11:10:35 +0000 Subject: [PATCH 12/32] correct iwr syntax do downlod dotnet-install --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 65520e85e..af1794867 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ install: # the legacy WMF4 image only has the old preview SDKs of dotnet if (-not ((dotnet --version).StartsWith('1.1'))) { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 .\dotnet-install.ps1 -Version 1.1 } From 94799b338939d67497222c010f67d2c2d932c3cf Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 11:23:37 +0000 Subject: [PATCH 13/32] correct syntax to install dotnet --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index af1794867..734c4a2e8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,8 +17,8 @@ install: # the legacy WMF4 image only has the old preview SDKs of dotnet if (-not ((dotnet --version).StartsWith('1.1'))) { - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Version 1.1 + Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 + .\dotnet-install.ps1 -Channel 1.1 } build_script: From 9454073e7c6ca184ee132393c58a6e0a337fc039 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:00:30 +0000 Subject: [PATCH 14/32] install pester for wmf 4 build --- appveyor.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 734c4a2e8..1f9530420 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,14 @@ clone_folder: c:\projects\psscriptanalyzer # Install Pester install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion + - ps:| + $Pester = Get-Module Pester -ListAvailable + $Pester + if ($null -eq $Pester) # WMF 4 build does not have pester + { + Install-Module Pester -Scope CurrentUser -RequiredVersion 3.4 + Import-Module Pester + } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet if (-not ((dotnet --version).StartsWith('1.1'))) From 17c3461e57d8c61f1fb63e888751f930941fd6ba Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:03:15 +0000 Subject: [PATCH 15/32] appveyor syntax fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1f9530420..b4ee5f6f0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ clone_folder: c:\projects\psscriptanalyzer # Install Pester install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion - - ps:| + - ps: | $Pester = Get-Module Pester -ListAvailable $Pester if ($null -eq $Pester) # WMF 4 build does not have pester From aa5d606ddecc8670cb45dd67f788c994bdfce816 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:08:52 +0000 Subject: [PATCH 16/32] PowerShellGet is not available in wmf4 -> use cinst instead --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b4ee5f6f0..1ec3c3a20 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,12 +14,12 @@ clone_folder: c:\projects\psscriptanalyzer install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion - ps: | - $Pester = Get-Module Pester -ListAvailable - $Pester - if ($null -eq $Pester) # WMF 4 build does not have pester + $requiredPesterVersion = '3.4' + $pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion } + $pester + if ($null -eq $pester) # WMF 4 build does not have pester { - Install-Module Pester -Scope CurrentUser -RequiredVersion 3.4 - Import-Module Pester + cinst -y pester --version 3.4.0 } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet From 9ebf1b1bca9261b677cd39abaed0ab0a3cf52457 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:11:01 +0000 Subject: [PATCH 17/32] use fullsemver of pester to install --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1ec3c3a20..77c031ce5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,12 +14,12 @@ clone_folder: c:\projects\psscriptanalyzer install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion - ps: | - $requiredPesterVersion = '3.4' + $requiredPesterVersion = '3.4.0' $pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion } $pester if ($null -eq $pester) # WMF 4 build does not have pester { - cinst -y pester --version 3.4.0 + cinst -y pester --version $requiredPesterVersion } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet From 7c2764264d5c83ac3cd5f3d60e5a90bfb0e29f7a Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:23:29 +0000 Subject: [PATCH 18/32] add cache back to appveyor --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 77c031ce5..a450b143f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,11 @@ environment: # clone directory clone_folder: c:\projects\psscriptanalyzer +# cache Nuget packages and dotnet CLI cache +cache: + - '%USERPROFILE%\.nuget\packages -> appveyor.yml' + - '%LocalAppData%\Microsoft\dotnet -> appveyor.yml' + # Install Pester install: - ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion From c857b615e1ae456b1b452d21988fac0c9a85598a Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:32:26 +0000 Subject: [PATCH 19/32] cleanup --- Engine/Engine.csproj | 2 +- Engine/Strings.Designer.cs | 4 +-- Engine/Strings.resx | 56 +++++++++++++++++++------------------- Rules/Rules.csproj | 2 +- appveyor.yml | 4 +-- buildCoreClr.ps1 | 2 -- 6 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj index f434cfefb..756fb5d53 100644 --- a/Engine/Engine.csproj +++ b/Engine/Engine.csproj @@ -2,7 +2,7 @@ 1.16.1 - net451;netstandard1.6 + netstandard1.6;net451 Microsoft.Windows.PowerShell.ScriptAnalyzer Engine $(PackageTargetFallback);dnxcore50 diff --git a/Engine/Strings.Designer.cs b/Engine/Strings.Designer.cs index 210fe571c..1f8db8c92 100644 --- a/Engine/Strings.Designer.cs +++ b/Engine/Strings.Designer.cs @@ -11,8 +11,8 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { using System; using System.Reflection; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// diff --git a/Engine/Strings.resx b/Engine/Strings.resx index f9bb6f8a3..5194830c3 100644 --- a/Engine/Strings.resx +++ b/Engine/Strings.resx @@ -1,17 +1,17 @@  - @@ -321,4 +321,4 @@ Input position should be less than that of the invoking object. - + \ No newline at end of file diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj index de43aff96..f899a9186 100644 --- a/Rules/Rules.csproj +++ b/Rules/Rules.csproj @@ -2,7 +2,7 @@ 1.16.1 - net451;netstandard1.6 + netstandard1.6;net451 Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules Rules $(PackageTargetFallback);dnxcore50 diff --git a/appveyor.yml b/appveyor.yml index a450b143f..94bca495d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,10 +40,10 @@ build_script: Push-Location C:\projects\psscriptanalyzer dotnet --version Push-Location .\Engine - dotnet restore Engine.csproj | Out-Null + dotnet restore Engine.csproj Pop-Location Push-Location Rules - dotnet restore Rules.csproj | Out-Null + dotnet restore Rules.csproj Pop-Location C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build C:\projects\psscriptanalyzer\build.ps1 -BuildDocs diff --git a/buildCoreClr.ps1 b/buildCoreClr.ps1 index c8c802c3d..29dcaa4e6 100644 --- a/buildCoreClr.ps1 +++ b/buildCoreClr.ps1 @@ -55,7 +55,6 @@ if ($build) { throw "Please restore project Engine" } - #.\New-StronglyTypedCsFileForResx.ps1 Engine Push-Location Engine\ dotnet build Engine.csproj --framework $Framework --configuration $Configuration Pop-Location @@ -65,7 +64,6 @@ if ($build) { throw "Please restore project Rules" } - #.\New-StronglyTypedCsFileForResx.ps1 Rules Push-Location Rules\ dotnet build Rules.csproj --framework $Framework --configuration $Configuration Pop-Location From d17f63c44f1102958679e7479c492add6031b58c Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 12:52:10 +0000 Subject: [PATCH 20/32] restore packages automatically the first time --- README.md | 9 --------- appveyor.yml | 6 ------ buildCoreClr.ps1 | 21 +++++++++++++++++++-- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 22d3a445d..2f94fff8c 100644 --- a/README.md +++ b/README.md @@ -95,15 +95,6 @@ Exit ```powershell cd path/to/PSScriptAnalyzer ``` -* Restore packages - ```powershell - pushd .\Engine - dotnet restore Engine.csproj - popd - pushd Rules - dotnet restore Rules.csproj - popd - ``` * Build for your platform * Windows PowerShell version 5.0 and greater ```powershell diff --git a/appveyor.yml b/appveyor.yml index 94bca495d..4db1569fe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,12 +39,6 @@ build_script: $PSVersionTable Push-Location C:\projects\psscriptanalyzer dotnet --version - Push-Location .\Engine - dotnet restore Engine.csproj - Pop-Location - Push-Location Rules - dotnet restore Rules.csproj - Pop-Location C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build C:\projects\psscriptanalyzer\build.ps1 -BuildDocs Pop-Location diff --git a/buildCoreClr.ps1 b/buildCoreClr.ps1 index 29dcaa4e6..8c1568d4e 100644 --- a/buildCoreClr.ps1 +++ b/buildCoreClr.ps1 @@ -1,5 +1,8 @@ param( + # Automatically performs a 'dotnet restore' when being run the first time [switch]$Build, + # Restore Projects in case NuGet packages have changed + [switch]$Restore, [switch]$Uninstall, [switch]$Install, @@ -23,6 +26,16 @@ Function Test-DotNetRestore Test-Path ([System.IO.Path]::Combine($projectPath, 'obj', 'project.assets.json')) } +function Invoke-RestoreProjects +{ + Push-Location (Join-Path $PSScriptRoot Engine) + dotnet restore Engine.csproj + Pop-Location + Push-Location (Join-Path $PSScriptRoot Rules) + dotnet restore Rules.csproj + Pop-Location +} + $solutionDir = Split-Path $MyInvocation.InvocationName if (-not (Test-Path "$solutionDir/global.json")) { @@ -47,13 +60,17 @@ elseif ($Configuration -match 'PSv3') { $destinationDirBinaries = "$destinationDir\PSv3" } +if ($Restore.IsPresent) +{ + Invoke-RestoreProjects +} if ($build) { if (-not (Test-DotNetRestore((Join-Path $solutionDir Engine)))) { - throw "Please restore project Engine" + Invoke-RestoreProjects } Push-Location Engine\ dotnet build Engine.csproj --framework $Framework --configuration $Configuration @@ -62,7 +79,7 @@ if ($build) if (-not (Test-DotNetRestore((Join-Path $solutionDir Rules)))) { - throw "Please restore project Rules" + Invoke-RestoreProjects } Push-Location Rules\ dotnet build Rules.csproj --framework $Framework --configuration $Configuration From 3a116628e789cc0caab2e335b732bf3bec288c24 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 13:02:06 +0000 Subject: [PATCH 21/32] rename VS solutions appropriately --- PSScriptAnalyzer.sln | 59 +++++++++++++++++++------------ PSScriptAnalyzerDocumentation.sln | 38 ++++++++++++++++++++ PSScriptAnalyzerNetCore.sln | 51 -------------------------- README.md | 3 +- Utils/RuleMaker.psm1 | 2 +- build.cmd | 2 +- 6 files changed, 78 insertions(+), 77 deletions(-) create mode 100644 PSScriptAnalyzerDocumentation.sln delete mode 100644 PSScriptAnalyzerNetCore.sln diff --git a/PSScriptAnalyzer.sln b/PSScriptAnalyzer.sln index c8843df1a..6b7e04454 100644 --- a/PSScriptAnalyzer.sln +++ b/PSScriptAnalyzer.sln @@ -1,38 +1,51 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerEngine", "Engine\ScriptAnalyzerEngine.csproj", "{F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}" +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Engine", "Engine\Engine.csproj", "{E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerBuiltinRules", "Rules\ScriptAnalyzerBuiltinRules.csproj", "{C33B6B9D-E61C-45A3-9103-895FD82A5C1E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rules", "Rules\Rules.csproj", "{D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - PSV3 Debug|Any CPU = PSV3 Debug|Any CPU - PSV3 Release|Any CPU = PSV3 Release|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.Build.0 = Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.Build.0 = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.ActiveCfg = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.Build.0 = Debug|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.Build.0 = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.Build.0 = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.ActiveCfg = Release|Any CPU + {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.ActiveCfg = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.Build.0 = Debug|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.Build.0 = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.ActiveCfg = Release|Any CPU + {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8354D5F1-95D7-48B3-B4BF-DD7AACDAA5BA} + EndGlobalSection EndGlobal diff --git a/PSScriptAnalyzerDocumentation.sln b/PSScriptAnalyzerDocumentation.sln new file mode 100644 index 000000000..c8843df1a --- /dev/null +++ b/PSScriptAnalyzerDocumentation.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerEngine", "Engine\ScriptAnalyzerEngine.csproj", "{F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerBuiltinRules", "Rules\ScriptAnalyzerBuiltinRules.csproj", "{C33B6B9D-E61C-45A3-9103-895FD82A5C1E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + PSV3 Debug|Any CPU = PSV3 Debug|Any CPU + PSV3 Release|Any CPU = PSV3 Release|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.Build.0 = Release|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PSScriptAnalyzerNetCore.sln b/PSScriptAnalyzerNetCore.sln deleted file mode 100644 index 6b7e04454..000000000 --- a/PSScriptAnalyzerNetCore.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2010 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Engine", "Engine\Engine.csproj", "{E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rules", "Rules\Rules.csproj", "{D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.ActiveCfg = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x64.Build.0 = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.ActiveCfg = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Debug|x86.Build.0 = Debug|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|Any CPU.Build.0 = Release|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.ActiveCfg = Release|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x64.Build.0 = Release|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.ActiveCfg = Release|Any CPU - {E3969A29-E511-46A3-ABF7-FA6AD4AAB33B}.Release|x86.Build.0 = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.ActiveCfg = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x64.Build.0 = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.ActiveCfg = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Debug|x86.Build.0 = Debug|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|Any CPU.Build.0 = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.ActiveCfg = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x64.Build.0 = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.ActiveCfg = Release|Any CPU - {D601FAC9-48CD-45B5-B4E8-9A3BD06E1436}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8354D5F1-95D7-48B3-B4BF-DD7AACDAA5BA} - EndGlobalSection -EndGlobal diff --git a/README.md b/README.md index 2f94fff8c..9edfd9edf 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,8 @@ Exit ```powershell cd path/to/PSScriptAnalyzer ``` -* Build for your platform +* Building + You can use either build using the `Visual Studio` solution `PSScriptAnalyzer.sln` or build for your platform as follows: * Windows PowerShell version 5.0 and greater ```powershell .\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build diff --git a/Utils/RuleMaker.psm1 b/Utils/RuleMaker.psm1 index fe01740c8..5aef5ec53 100644 --- a/Utils/RuleMaker.psm1 +++ b/Utils/RuleMaker.psm1 @@ -22,7 +22,7 @@ Function Get-SolutionRoot $PSModule = $ExecutionContext.SessionState.Module $path = $PSModule.ModuleBase $root = Split-Path -Path $path -Parent - $solutionFilename = 'psscriptanalyzer.sln' + $solutionFilename = 'PSScriptAnalyzerDocumentation.sln' if (-not (Test-Path (Join-Path $root $solutionFilename))) { return $null diff --git a/build.cmd b/build.cmd index 8b73e3e3e..6cdad995c 100644 --- a/build.cmd +++ b/build.cmd @@ -17,7 +17,7 @@ msbuild %solutionPath% /p:Configuration=%configuration% /l:FileLogger,Microsoft GOTO END :CLEAN -msbuild .\PSScriptAnalyzer.sln /p:Configuration=%configuration% /t:clean /l:FileLogger,Microsoft.Build.Engine;logfile=PSScriptAnalyzer_Build.log;append=true +msbuild .\PSScriptAnalyzerDocumentation.sln /p:Configuration=%configuration% /t:clean /l:FileLogger,Microsoft.Build.Engine;logfile=PSScriptAnalyzer_Build.log;append=true GOTO END :NOTOOLS From 3798d454b8d9a0d19480628dbc8216f89229afc1 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 13:06:26 +0000 Subject: [PATCH 22/32] simplify restore to do it on the solution --- buildCoreClr.ps1 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/buildCoreClr.ps1 b/buildCoreClr.ps1 index 8c1568d4e..86a28a1c5 100644 --- a/buildCoreClr.ps1 +++ b/buildCoreClr.ps1 @@ -26,14 +26,9 @@ Function Test-DotNetRestore Test-Path ([System.IO.Path]::Combine($projectPath, 'obj', 'project.assets.json')) } -function Invoke-RestoreProjects +function Invoke-RestoreSolution { - Push-Location (Join-Path $PSScriptRoot Engine) - dotnet restore Engine.csproj - Pop-Location - Push-Location (Join-Path $PSScriptRoot Rules) - dotnet restore Rules.csproj - Pop-Location + dotnet restore (Join-Path $PSScriptRoot .\PSScriptAnalyzer.sln) } $solutionDir = Split-Path $MyInvocation.InvocationName @@ -62,7 +57,7 @@ elseif ($Configuration -match 'PSv3') { if ($Restore.IsPresent) { - Invoke-RestoreProjects + Invoke-RestoreSolution } if ($build) @@ -70,7 +65,7 @@ if ($build) if (-not (Test-DotNetRestore((Join-Path $solutionDir Engine)))) { - Invoke-RestoreProjects + Invoke-RestoreSolution } Push-Location Engine\ dotnet build Engine.csproj --framework $Framework --configuration $Configuration @@ -79,7 +74,7 @@ if ($build) if (-not (Test-DotNetRestore((Join-Path $solutionDir Rules)))) { - Invoke-RestoreProjects + Invoke-RestoreSolution } Push-Location Rules\ dotnet build Rules.csproj --framework $Framework --configuration $Configuration From 2294b902caf36352fbb8cccd6493ec311db276d7 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 13:09:47 +0000 Subject: [PATCH 23/32] update download link for .net core 1.1.5 sdk --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9edfd9edf..2f4702bd7 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Exit ### From Source #### Requirements -* [.NET Core 1.0 SDK Preview 2](https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.0-preview2-download.md) +* [.NET Core 1.1.5 SDK](https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.5.md) * [PlatyPS 0.5.0 or greater](https://github.com/PowerShell/platyPS) #### Steps From fc5f2184a3c66515b289861c5bfd5ed22ba09f6a Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 13:11:28 +0000 Subject: [PATCH 24/32] add pester version to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f4702bd7..19200a8fc 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ To confirm installation: run `Get-ScriptAnalyzerRule` in the PowerShell console #### Tests Pester-based ScriptAnalyzer Tests are located in `path/to/PSScriptAnalyzer/Tests` folder. -* Ensure Pester is installed on the machine +* Ensure Pester 3.4 is installed on the machine * Copy `path/to/PSScriptAnalyzer/out/PSScriptAnalyzer` to a folder in `PSModulePath` * Go the Tests folder in your local repository * Run Engine Tests: From c7c3ce104ae5c0a337ea432cb8f2e48cb0aedd62 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 19:24:16 +0000 Subject: [PATCH 25/32] try to see if it is possible to get rid of the old solution --- PSScriptAnalyzerDocumentation.sln | 38 ------------------------------- Utils/RuleMaker.psm1 | 2 +- build.cmd | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 PSScriptAnalyzerDocumentation.sln diff --git a/PSScriptAnalyzerDocumentation.sln b/PSScriptAnalyzerDocumentation.sln deleted file mode 100644 index c8843df1a..000000000 --- a/PSScriptAnalyzerDocumentation.sln +++ /dev/null @@ -1,38 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerEngine", "Engine\ScriptAnalyzerEngine.csproj", "{F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptAnalyzerBuiltinRules", "Rules\ScriptAnalyzerBuiltinRules.csproj", "{C33B6B9D-E61C-45A3-9103-895FD82A5C1E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - PSV3 Debug|Any CPU = PSV3 Debug|Any CPU - PSV3 Release|Any CPU = PSV3 Release|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}.Release|Any CPU.Build.0 = Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.ActiveCfg = PSV3 Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Debug|Any CPU.Build.0 = PSV3 Debug|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.ActiveCfg = PSV3 Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.PSV3 Release|Any CPU.Build.0 = PSV3 Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Utils/RuleMaker.psm1 b/Utils/RuleMaker.psm1 index 5aef5ec53..cea6af750 100644 --- a/Utils/RuleMaker.psm1 +++ b/Utils/RuleMaker.psm1 @@ -22,7 +22,7 @@ Function Get-SolutionRoot $PSModule = $ExecutionContext.SessionState.Module $path = $PSModule.ModuleBase $root = Split-Path -Path $path -Parent - $solutionFilename = 'PSScriptAnalyzerDocumentation.sln' + $solutionFilename = 'PSScriptAnalyzer.sln' if (-not (Test-Path (Join-Path $root $solutionFilename))) { return $null diff --git a/build.cmd b/build.cmd index 6cdad995c..8b73e3e3e 100644 --- a/build.cmd +++ b/build.cmd @@ -17,7 +17,7 @@ msbuild %solutionPath% /p:Configuration=%configuration% /l:FileLogger,Microsoft GOTO END :CLEAN -msbuild .\PSScriptAnalyzerDocumentation.sln /p:Configuration=%configuration% /t:clean /l:FileLogger,Microsoft.Build.Engine;logfile=PSScriptAnalyzer_Build.log;append=true +msbuild .\PSScriptAnalyzer.sln /p:Configuration=%configuration% /t:clean /l:FileLogger,Microsoft.Build.Engine;logfile=PSScriptAnalyzer_Build.log;append=true GOTO END :NOTOOLS From 7edf422c255db2617b6f453f76590207b9a93fd3 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 19:32:06 +0000 Subject: [PATCH 26/32] try to get rid of the last call to the resource generation script --- .build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.build.ps1 b/.build.ps1 index 79ca9eecb..72e4561de 100644 --- a/.build.ps1 +++ b/.build.ps1 @@ -136,14 +136,14 @@ popd $projects = @("engine", "rules") $projects | ForEach-Object { - Add-ProjectTask $_ buildResource (Get-ResourceTaskParam $_) + #Add-ProjectTask $_ buildResource (Get-ResourceTaskParam $_) Add-ProjectTask $_ build (Get-BuildTaskParams $_) Add-ProjectTask $_ restore (Get-RestoreTaskParams $_) Add-ProjectTask $_ clean (Get-CleanTaskParams $_) Add-ProjectTask $_ test (Get-TestTaskParam $_) "$BuildRoot/tests" } -task buildResource -Before build "engine/buildResource", "rules/buildResource" +#task buildResource -Before build "engine/buildResource", "rules/buildResource" task build "engine/build", "rules/build" task restore "engine/restore", "rules/restore" task clean "engine/clean", "rules/clean" From 2ded58df0d175421036534637a44a1b322a8d465 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 19:56:14 +0000 Subject: [PATCH 27/32] update readme with full path to out directory --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19200a8fc..52f25bfe2 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Exit ``` * Import the module ```powershell -Import-Module /path/to/PSScriptAnalyzer/out/PSScriptAnalyzer +Import-Module .\out\PSScriptAnalyzer\PSScriptAnalyzer.psd1 ``` To confirm installation: run `Get-ScriptAnalyzerRule` in the PowerShell console to obtain the built-in rules From ff833175d4a92aaa241d89ebfbe56e8812d99b22 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 20:09:11 +0000 Subject: [PATCH 28/32] remove the remainders of the ressource generation script calls and document it --- .build.ps1 | 17 ----------------- New-StronglyTypedCsFileForResx.ps1 | 8 ++++++-- README.md | 10 ++++++++-- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.build.ps1 b/.build.ps1 index 72e4561de..b1d94d75f 100644 --- a/.build.ps1 +++ b/.build.ps1 @@ -9,7 +9,6 @@ param( # todo remove aliases # todo make each project have its own build script -$resourceScript = Join-Path $BuildRoot "New-StronglyTypedCsFileForResx.ps1" $outPath = "$BuildRoot/out" $modulePath = "$outPath/PSScriptAnalyzer" @@ -109,20 +108,6 @@ function Get-TestTaskParam($project) { } } -function Get-ResourceTaskParam($project) { - @{ - Inputs = "$project/Strings.resx" - Outputs = "$project/Strings.cs" - Data = $project - Jobs = { - Push-Location $BuildRoot - & $resourceScript $Task.Data - Pop-Location - } - Before = "$project/build" - } -} - function Add-ProjectTask([string]$project, [string]$taskName, [hashtable]$taskParams, [string]$pathPrefix = $buildRoot) { $jobs = [scriptblock]::Create(@" pushd $pathPrefix/$project @@ -136,14 +121,12 @@ popd $projects = @("engine", "rules") $projects | ForEach-Object { - #Add-ProjectTask $_ buildResource (Get-ResourceTaskParam $_) Add-ProjectTask $_ build (Get-BuildTaskParams $_) Add-ProjectTask $_ restore (Get-RestoreTaskParams $_) Add-ProjectTask $_ clean (Get-CleanTaskParams $_) Add-ProjectTask $_ test (Get-TestTaskParam $_) "$BuildRoot/tests" } -#task buildResource -Before build "engine/buildResource", "rules/buildResource" task build "engine/build", "rules/build" task restore "engine/restore", "rules/restore" task clean "engine/clean", "rules/clean" diff --git a/New-StronglyTypedCsFileForResx.ps1 b/New-StronglyTypedCsFileForResx.ps1 index 41def3be5..5fb0ee9ea 100644 --- a/New-StronglyTypedCsFileForResx.ps1 +++ b/New-StronglyTypedCsFileForResx.ps1 @@ -1,4 +1,8 @@ -param( +<# +# This script can be used to update the *.Designer file if a *.resx ressource file has been updated. +# However, it is recommended to use Visual Studio instead for editing ressources instead since it takes of that automatically and prodcues cleaner diffs. +#> +param( [ValidateSet("Engine","Rules")] [string] $project ) @@ -132,7 +136,7 @@ if (-not (Test-Path "$projectRoot/global.json")) throw "Not in solution root: $projectRoot" } $inputFilePath = Join-Path $projectRoot "$project/Strings.resx" -$outputFilePath = Join-Path $projectRoot "$project/Strings.cs" +$outputFilePath = Join-Path $projectRoot "$project/Strings.Designer.cs" $className = "Microsoft.Windows.PowerShell.ScriptAnalyzer" if ($project -eq "Rules") { diff --git a/README.md b/README.md index 52f25bfe2..9a663b944 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,11 @@ Exit #### Requirements * [.NET Core 1.1.5 SDK](https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.5.md) * [PlatyPS 0.5.0 or greater](https://github.com/PowerShell/platyPS) +* Optionally but recommended for development: [Visual Studio 2017](https://www.visualstudio.com/downloads/) #### Steps * Obtain the source - - Download the latest source code from the release page (https://github.com/PowerShell/PSScriptAnalyzer/releases) OR + - Download the latest source code from the [release page](https://github.com/PowerShell/PSScriptAnalyzer/releases) OR - Clone the repository (needs git) ```powershell git clone https://github.com/PowerShell/PSScriptAnalyzer @@ -96,7 +97,8 @@ Exit cd path/to/PSScriptAnalyzer ``` * Building - You can use either build using the `Visual Studio` solution `PSScriptAnalyzer.sln` or build for your platform as follows: + + You can either build using the `Visual Studio` solution `PSScriptAnalyzer.sln` or build using `PowerShell` specifically for your platform as follows: * Windows PowerShell version 5.0 and greater ```powershell .\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build @@ -120,6 +122,10 @@ Import-Module .\out\PSScriptAnalyzer\PSScriptAnalyzer.psd1 To confirm installation: run `Get-ScriptAnalyzerRule` in the PowerShell console to obtain the built-in rules +* Adding/Removing resource strings + +For adding/removing resource strings in the `*.resx` files, it is recommended to use `Visual Studio` since it automatically updates the strongly typed `*.Designer.cs` files. The `Visual Studio 2017 Community Edition` is free to use but should you not have/want to use `Visual Studio` then you can either manually adapt the `*.Designer.cs` files or use the `New-StronglyTypedCsFileForResx.ps1` script although the latter is discouraged since it leads to a bad diff of the `*.Designer.cs` files. + #### Tests Pester-based ScriptAnalyzer Tests are located in `path/to/PSScriptAnalyzer/Tests` folder. From d1eb2addbac856c316cda2c631638367dc21e53e Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 2 Dec 2017 20:23:03 +0000 Subject: [PATCH 29/32] csproj cleanup from the old DNX or preview days --- .gitignore | 2 +- Engine/Engine.csproj | 3 +-- Rules/Rules.csproj | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ae004a34e..329ec9bd5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,7 @@ TestResult.xml [Rr]eleasePS/ dlldata.c -# DNX +# .Net Core CLI project.lock.json artifacts/ diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj index 756fb5d53..2981cf2f6 100644 --- a/Engine/Engine.csproj +++ b/Engine/Engine.csproj @@ -5,7 +5,6 @@ netstandard1.6;net451 Microsoft.Windows.PowerShell.ScriptAnalyzer Engine - $(PackageTargetFallback);dnxcore50 Microsoft.Windows.PowerShell.ScriptAnalyzer @@ -28,7 +27,7 @@ - + diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj index f899a9186..40a21d218 100644 --- a/Rules/Rules.csproj +++ b/Rules/Rules.csproj @@ -35,7 +35,7 @@ - + From d10642084412ffb65dfe57ed4fdbc35a09d5041d Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Jan 2018 23:03:50 +0000 Subject: [PATCH 30/32] upgrade from netcore 1.1 to 2.0 (same sdk version as pwsh 6.0.1) --- appveyor.yml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4db1569fe..5c537b4fc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,10 +28,10 @@ install: } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet - if (-not ((dotnet --version).StartsWith('1.1'))) + if (-not ((dotnet --version).StartsWith('2.0'))) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Channel 1.1 + .\dotnet-install.ps1 -Channel 2.0 } build_script: diff --git a/global.json b/global.json index a7d00c0aa..9144b7882 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "Rules" ], "sdk": { - "version": "1.1.5" + "version": "2.0.2" } } From 8a0d1afd74ad355c5f231c2fc805d78fce9ac966 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Jan 2018 23:28:55 +0000 Subject: [PATCH 31/32] update sdk to get 2.0.5 runtime (old sdk had only 2.0.0 runtime) --- appveyor.yml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5c537b4fc..72a0f5883 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,10 +28,10 @@ install: } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet - if (-not ((dotnet --version).StartsWith('2.0'))) + if (-not ((dotnet --version).StartsWith('2.1'))) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Channel 2.0 + .\dotnet-install.ps1 -Channel 2.1 } build_script: diff --git a/global.json b/global.json index 9144b7882..0b0ba35ab 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "Rules" ], "sdk": { - "version": "2.0.2" + "version": "2.1.4" } } From 38d600ffd39d6269989f93e7c61b0250ae7019e1 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Jan 2018 23:37:04 +0000 Subject: [PATCH 32/32] update appveyor installation of sdk and readme --- README.md | 2 +- appveyor.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9a663b944..d643a3241 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Exit ### From Source #### Requirements -* [.NET Core 1.1.5 SDK](https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.5.md) +* [.NET Core 2.1.4 SDK](https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.5-download.md) * [PlatyPS 0.5.0 or greater](https://github.com/PowerShell/platyPS) * Optionally but recommended for development: [Visual Studio 2017](https://www.visualstudio.com/downloads/) diff --git a/appveyor.yml b/appveyor.yml index 72a0f5883..6243fdc67 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,10 +28,10 @@ install: } - ps: | # the legacy WMF4 image only has the old preview SDKs of dotnet - if (-not ((dotnet --version).StartsWith('2.1'))) + if (-not ((dotnet --version).StartsWith('2.1.4'))) { Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Channel 2.1 + .\dotnet-install.ps1 -Version 2.1.4 } build_script: