Skip to content

Commit

Permalink
Net Core - Support Central Package Management
Browse files Browse the repository at this point in the history
- Use VersionOverride in .targets file when ManagePackageVersionsCentrally == true

Resolves #4362
  • Loading branch information
amaitland committed Mar 7, 2023
1 parent edf99b5 commit 5b61574
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
21 changes: 16 additions & 5 deletions NuGet/PackageReference/CefSharp.Common.NETCore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,22 @@
</ItemGroup>
</When>
<Otherwise>
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' != 'true'">
<PackageReference Include="chromiumembeddedframework.runtime.win-x64" Version="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-x86" Version="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-arm64" Version="111.0.11" />
</ItemGroup>
<Choose>
<When Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
<ItemGroup>
<PackageReference Include="chromiumembeddedframework.runtime.win-x64" VersionOverride="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-x86" VersionOverride="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-arm64" VersionOverride="111.0.11" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="chromiumembeddedframework.runtime.win-x64" Version="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-x86" Version="111.0.11" />
<PackageReference Include="chromiumembeddedframework.runtime.win-arm64" Version="111.0.11" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Content Include="@(CefRuntimeWin32Locales)">
<Link>runtimes\win-x86\native\locales\%(RecursiveDir)%(FileName)%(Extension)</Link>
Expand Down
9 changes: 7 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,16 @@ function WriteVersionToNugetTargets
$Filename = Join-Path $WorkingDir NuGet\PackageReference\CefSharp.Common.NETCore.targets

Write-Diagnostic "Write Version ($RedistVersion) to $Filename"

$RunTimeJsonData = Get-Content -Encoding UTF8 $Filename

$Regex1 = '" Version=".*"';
$Replace = '" Version="' + $RedistVersion + '"';

$RunTimeJsonData = Get-Content -Encoding UTF8 $Filename
$NewString = $RunTimeJsonData -replace $Regex1, $Replace

$Regex1 = '" VersionOverride=".*"';
$Replace = '" VersionOverride="' + $RedistVersion + '"';
$NewString = $NewString -replace $Regex1, $Replace

$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
Expand Down

0 comments on commit 5b61574

Please sign in to comment.