From 3e130b0cde385cdab18870a49d716493328bd501 Mon Sep 17 00:00:00 2001 From: BruceHaley Date: Fri, 6 Jul 2018 10:23:57 -0700 Subject: [PATCH] Publish to MyGet feed plus auto versioning for Bot Builder V3. (#4817) * Set up automated versioning for all projects. * Version references fixed in 3 projects. * Rename .nuspec to match .csproj file name. * Add bones folder to .gitignore * revert .nuspec files for AspNetCore projects. * Add buildtools\SetVersionInNuspecFile.ps1 * File version setting removed from AssemblyInfo.cs. for Microsoft.Bot.Builder and Microsoft.Bot.Connector.AspNetCore2 and * .gitignores updated. * Version setting added to 2 .csproj files, Microsoft.Bot.Builder, Microsoft.Bot.Builder.Autofac. * Add SetVersionInAssemblyInfoCsFiles.ps1 * Changed assembly name to Microsoft.Bot.Connector.AspNetCore2. * AssemblyVersion uncommented in AssemblyInfo.cs * Diagnostic message added to SetVersionInAssembliInforCsFies.ps1 * Fixed Microsoft.Bot.Connector.AspNetCore2.nuspec * Reverting some of netcore2 changes. * Tweak --- .gitignore | 16 +++++++ CSharp/Directory.Build.props | 10 +++++ .../Microsoft.Bot.Builder.Calling.nuspec | 2 +- ...Microsoft.Bot.Builder.FormFlow.Json.nuspec | 2 +- .../Microsoft.Bot.Builder.History.nuspec | 2 +- .../Microsoft.Bot.Builder.nuspec | 2 +- .../Microsoft.Bot.Connector.AspNetCore.csproj | 7 +-- ...Microsoft.Bot.Connector.AspNetCore2.csproj | 4 +- ...Microsoft.Bot.Connector.AspNetCore2.nuspec | 2 +- ...crosoft.Bot.Connector.NetFramework.nuspec} | 2 +- .../SetVersionInAssemblyInfoCsFiles.ps1 | 43 +++++++++++++++++++ CSharp/buildtools/SetVersionInNuspecFile.ps1 | 11 +++++ CSharp/buildtools/updateAssemblyInfo.ps1 | 1 + 13 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 .gitignore create mode 100644 CSharp/Directory.Build.props rename CSharp/Library/Microsoft.Bot.Connector.NetFramework/{Microsoft.Bot.Connector.nuspec => Microsoft.Bot.Connector.NetFramework.nuspec} (99%) create mode 100644 CSharp/buildtools/SetVersionInAssemblyInfoCsFiles.ps1 create mode 100644 CSharp/buildtools/SetVersionInNuspecFile.ps1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e81060738 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ + +bones/ \ No newline at end of file diff --git a/CSharp/Directory.Build.props b/CSharp/Directory.Build.props new file mode 100644 index 000000000..5a0e91d50 --- /dev/null +++ b/CSharp/Directory.Build.props @@ -0,0 +1,10 @@ + + + + 3.15.3.0-local + $(PackageVersion) + 3.15.3.0-local + $(PackageVersion) + + + \ No newline at end of file diff --git a/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.nuspec b/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.nuspec index f4d5064dd..b9507c8f5 100644 --- a/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.nuspec +++ b/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.nuspec @@ -19,7 +19,7 @@ - + diff --git a/CSharp/Library/Microsoft.Bot.Builder.FormFlow.Json/Microsoft.Bot.Builder.FormFlow.Json.nuspec b/CSharp/Library/Microsoft.Bot.Builder.FormFlow.Json/Microsoft.Bot.Builder.FormFlow.Json.nuspec index 3caf3831b..3b04515ff 100644 --- a/CSharp/Library/Microsoft.Bot.Builder.FormFlow.Json/Microsoft.Bot.Builder.FormFlow.Json.nuspec +++ b/CSharp/Library/Microsoft.Bot.Builder.FormFlow.Json/Microsoft.Bot.Builder.FormFlow.Json.nuspec @@ -17,7 +17,7 @@ A Microsoft Bot Builder extension for declaratively specifying FormFlow dialogs using JSON Schema. en-US - + diff --git a/CSharp/Library/Microsoft.Bot.Builder.History/Microsoft.Bot.Builder.History.nuspec b/CSharp/Library/Microsoft.Bot.Builder.History/Microsoft.Bot.Builder.History.nuspec index 116536f2d..fea1f4b54 100644 --- a/CSharp/Library/Microsoft.Bot.Builder.History/Microsoft.Bot.Builder.History.nuspec +++ b/CSharp/Library/Microsoft.Bot.Builder.History/Microsoft.Bot.Builder.History.nuspec @@ -17,7 +17,7 @@ Microsoft History extensions for Microsoft.Bot.Builder. en-US - + diff --git a/CSharp/Library/Microsoft.Bot.Builder/Microsoft.Bot.Builder.nuspec b/CSharp/Library/Microsoft.Bot.Builder/Microsoft.Bot.Builder.nuspec index 3c6755238..89eabf95d 100644 --- a/CSharp/Library/Microsoft.Bot.Builder/Microsoft.Bot.Builder.nuspec +++ b/CSharp/Library/Microsoft.Bot.Builder/Microsoft.Bot.Builder.nuspec @@ -28,7 +28,7 @@ - + diff --git a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore/Microsoft.Bot.Connector.AspNetCore.csproj b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore/Microsoft.Bot.Connector.AspNetCore.csproj index 629422c51..d5f6a00d8 100644 --- a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore/Microsoft.Bot.Connector.AspNetCore.csproj +++ b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore/Microsoft.Bot.Connector.AspNetCore.csproj @@ -1,6 +1,8 @@ + $(NetCoreVersion) + $(NetCoreVersion) Microsoft.Bot.Connector netstandard1.6 $(NoWarn);CS1591 @@ -9,10 +11,9 @@ Microsoft.Bot.Connector.AspNetCore 1.6.0 $(PackageTargetFallback);dnxcore50 - 1.1.3.0 - 1.1.3.0 + + Microsoft.Bot.Connector - 1.1.3.0 false false diff --git a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.csproj b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.csproj index c6a15a66c..c3ae52027 100644 --- a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.csproj +++ b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.csproj @@ -1,6 +1,8 @@ + $(NetCore2Version) + $(NetCore2Version) netstandard2.0 Microsoft.Bot.Connector.AspNetCore Microsoft.Bot.Connector @@ -12,8 +14,6 @@ This library implements C# classes for using the Bot Framework Connector REST API, using the ASP.NET Core 2.x Microsoft http://github.com/microsoft/BotBuilder - Microsoft.Bot.Connector.AspNetCore - Microsoft.Bot.Connector false false diff --git a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.nuspec b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.nuspec index db6363281..a15c23226 100644 --- a/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.nuspec +++ b/CSharp/Library/Microsoft.Bot.Connector.AspNetCore2/Microsoft.Bot.Connector.AspNetCore2.nuspec @@ -2,7 +2,7 @@ Microsoft.Bot.Connector.AspNetCore - 2.0.1.9 + 2.0.1.19 Microsoft microsoft, BotFramework, nugetbotbuilder https://bots.botframework.com/Client/Images/bot-framework-default-7.png diff --git a/CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.nuspec b/CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.NetFramework.nuspec similarity index 99% rename from CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.nuspec rename to CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.NetFramework.nuspec index f31e2555b..93638f493 100644 --- a/CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.nuspec +++ b/CSharp/Library/Microsoft.Bot.Connector.NetFramework/Microsoft.Bot.Connector.NetFramework.nuspec @@ -2,7 +2,7 @@ Microsoft.Bot.Connector - 3.15.3.0 + $version$ Microsoft microsoft, BotFramework, nugetbotbuilder https://bots.botframework.com/Client/Images/bot-framework-default-7.png diff --git a/CSharp/buildtools/SetVersionInAssemblyInfoCsFiles.ps1 b/CSharp/buildtools/SetVersionInAssemblyInfoCsFiles.ps1 new file mode 100644 index 000000000..249a15236 --- /dev/null +++ b/CSharp/buildtools/SetVersionInAssemblyInfoCsFiles.ps1 @@ -0,0 +1,43 @@ +# Set version in AssemblyInfo.cs files. +Param ( + [string]$rootFolder, + [string]$version, + [string]$filePattern = "AssemblyInfo.cs" +) + +function UpdateAssemblyInfo() +{ + foreach ($file in $input) + { + $path = $file.FullName + Write-Host ($path) + $isUpdated = $false + + $patternAV = '^((?!\/\/).)*\[assembly: AssemblyVersion\("(.*)"\)\]' + $patternAFV = '^((?!\/\/).)*\[assembly: AssemblyFileVersion\("(.*)"\)\]' + (Get-Content $path) | ForEach-Object{ + if($_ -match $patternAV){ + # We have found the matching line + $isUpdated = $true + '[assembly: AssemblyVersion("{0}")]' -f $version + } elseif($_ -match $patternAFV){ + $isUpdated = $true + # We have found the matching line + '[assembly: AssemblyFileVersion("{0}")]' -f $version + } else { + # Output line as is + $_ + } + } | Set-Content $path + if (!$isUpdated) { + Write-Host ' Nothing found to update.' + } + } +} + +Write-Host ("Root folder: " + $rootFolder) +Write-Host ("File pattern: " + $filePattern) +Write-Host ("Version: " + $version) + +Write-Host ("Updating files...") +Get-Childitem -Path $rootFolder -recurse |? {$_.Name -like $filePattern} | UpdateAssemblyInfo; diff --git a/CSharp/buildtools/SetVersionInNuspecFile.ps1 b/CSharp/buildtools/SetVersionInNuspecFile.ps1 new file mode 100644 index 000000000..5e432f2fa --- /dev/null +++ b/CSharp/buildtools/SetVersionInNuspecFile.ps1 @@ -0,0 +1,11 @@ +param +( + [string]$fileFullPath, + [string]$version +) + +[xml]$myXML = Get-Content $fileFullPath + +$myXML.package.metadata.version = $version + +$myXML.Save($fileFullPath) \ No newline at end of file diff --git a/CSharp/buildtools/updateAssemblyInfo.ps1 b/CSharp/buildtools/updateAssemblyInfo.ps1 index c5fc1a99c..35bdc0406 100644 --- a/CSharp/buildtools/updateAssemblyInfo.ps1 +++ b/CSharp/buildtools/updateAssemblyInfo.ps1 @@ -1,3 +1,4 @@ +# Modify AssemblyInfo.cs files for delay signing: Remove InternalsVisibleTo attributes and add delay signing attributes. Param ([string]$rootFolder = $(get-location).Path, [string]$filePattern )