This repository has been archived by the owner on Dec 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#449] [9.1] Initial project updates for 9.1 to get things building /…
… running * Updated target framework * updated PackageReference's to use new nuget feed * No NoReference packages * New versioning * Included script for converting PackageReference in projects * Organized / cleaned up other nuget-related scripts * Script to add NoWarn tags for NU1603, which pops up from the new nuget structure * Allow for conditional local assembly references (for development against internal Sitecore previews) * Other tweaks / upgrades to references (e.g. MVC, DI, Owin, Logging, Newtonsoft versions) * Added many missing references that were broken previous to 9.0 and then fixed, likely being saved by CopyLocal? * Some minor breaking API changes * Updated CopyLocal on test projects to make assemblies available * Added some missing runtime dependencies to unit tests
- Loading branch information
1 parent
eca6ab0
commit 4f15bc6
Showing
83 changed files
with
2,888 additions
and
1,155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,3 +244,4 @@ results | |
npm-debug.log | ||
.DS_Store | ||
|
||
/BuildConfiguration.csproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
$ns = @{x = 'http://schemas.microsoft.com/developer/msbuild/2003'} | ||
|
||
function Add-XMLAttribute([System.Xml.XmlNode] $Node, $Name, $Value) | ||
{ | ||
$attrib = $Node.OwnerDocument.CreateAttribute($Name) | ||
$attrib.Value = $Value | ||
$node.Attributes.Append($attrib) | ||
} | ||
|
||
function Create-XMLElement([System.Xml.XmlNode] $Node, $Name) | ||
{ | ||
$Node.OwnerDocument.CreateElement($Name, $ns.x) | ||
} | ||
|
||
Get-ChildItem *.csproj -recurse | % { | ||
New-Object psobject -Property @{ | ||
File = $_ | ||
ProjectXml = [xml](gc $_ -Raw) | ||
} | ||
} | % { | ||
$_.ProjectXml.Project.ItemGroup | % { | ||
$itemGroup = $_ | ||
$projectNode = $itemGroup.ParentNode | ||
$packageReferences = @() | ||
|
||
# collect the package references | ||
if ($itemGroup.PackageReference.Count -lt 1) { | ||
return | ||
} | ||
$itemGroup.PackageReference | ? { | ||
$_.Include.StartsWith("Sitecore") -and -not $_.Include.Contains("FakeDb") | ||
} | % { | ||
$packageReferences += $_ | ||
} | ||
if ($packageReferences.Count -lt 1) { | ||
return | ||
} | ||
|
||
# remove package references from existing item group | ||
$packageReferences | % { | ||
$itemGroup.RemoveChild($_) | ||
} | ||
|
||
# add the build config import | ||
$import = Create-XMLElement -Node $projectNode -Name Import | ||
Add-XMLAttribute -Node $import -Name Project -Value '$(SolutionDir)\BuildConfiguration.csproj' | out-null | ||
Add-XMLAttribute -Node $import -Name Condition -Value 'Exists(''$(SolutionDir)\BuildConfiguration.csproj'')' | out-null | ||
$projectNode.PrependChild($import) | ||
|
||
# create the choose which will replace existing item group, and the conditional | ||
$choose = Create-XMLElement -Node $projectNode -Name Choose | ||
$when = Create-XMLElement -Node $projectNode -Name When | ||
Add-XMLAttribute -Node $when -Name Condition -Value '''$(LocalReferences)'' == ''true''' | out-null | ||
$choose.AppendChild($when) | ||
|
||
# create the new item group to go in the conditional | ||
$localReferenceGroup = Create-XMLElement -Node $_ -Name ItemGroup | ||
$packageReferences | % { | ||
$assembly = $_.Include.Replace('.NoReferences', '') | ||
$reference = Create-XMLElement -Node $_ -Name Reference | ||
Add-XMLAttribute -Node $reference -Name Include -Value $assembly | out-null | ||
$hintPath = Create-XMLElement -Node $_ -Name HintPath | ||
$hintPath.InnerText = "`$(SitecorePath)\bin\$assembly.dll" | ||
$reference.AppendChild($hintPath) | ||
$private = Create-XMLElement -Node $_ -Name Private | ||
$private.InnerText = "False" | ||
$reference.AppendChild($private) | ||
$localReferenceGroup.AppendChild($reference) | ||
} | ||
$when.AppendChild($localReferenceGroup) | ||
|
||
# add the package reference item group as default | ||
$otherwise = Create-XMLElement -Node $projectNode -Name Otherwise | ||
$choose.AppendChild($otherwise) | ||
$packageReferenceGroup = Create-XMLElement -Node $_ -Name ItemGroup | ||
$otherwise.AppendChild($packageReferenceGroup) | ||
$packageReferences | % { | ||
$packageReferenceGroup.AppendChild($_) | ||
} | ||
|
||
# add the choose | ||
$projectNode.InsertAfter($choose, $itemGroup) | ||
|
||
# remove the original item group if empty | ||
if (-not $itemGroup.HasChildNodes) { | ||
$projectNode.RemoveChild($itemGroup) | ||
} | ||
} | ||
$_.ProjectXml.Save($_.File) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$ns = @{x = 'http://schemas.microsoft.com/developer/msbuild/2003'} | ||
$noWarn = "NU1603" | ||
|
||
function Create-XMLElement([System.Xml.XmlNode] $Node, $Name) | ||
{ | ||
$Node.OwnerDocument.CreateElement($Name, $ns.x) | ||
} | ||
|
||
## Find all Visual Studio projects and parse their XML | ||
Get-ChildItem *.csproj -recurse | % { | ||
New-Object psobject -Property @{ | ||
File = $_ | ||
ProjectXml = [xml](gc $_ -Raw) | ||
} | ||
} | % { | ||
$propertyGroup = $_.ProjectXml.Project.PropertyGroup[0] | ||
if (-not $propertyGroup) { | ||
return | ||
} | ||
$noWarnElement = Create-XMLElement -Node $propertyGroup -Name NoWarn | ||
$noWarnElement.InnerText = $noWarn | ||
$propertyGroup.AppendChild($noWarnElement) | out-null | ||
$_.ProjectXml.Save($_.File) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.