Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

<PropertyGroup>
<Product>VirtoCommerce</Product>
<Copyright>Copyright © VirtoCommerce 2011-2025</Copyright>
<Copyright>Copyright © VirtoCommerce 2011-2026</Copyright>
<Authors>VirtoCommerce</Authors>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>3.918.0</VersionPrefix>
<VersionPrefix>3.1000.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<NoWarn>$(NoWarn);S3875;S4457</NoWarn>
Expand All @@ -24,10 +24,17 @@
<!-- Nuget Package Details -->
<PackageVersion>$(VersionPrefix)</PackageVersion>
<PackageVersion Condition=" '$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
<PackageIconUrl>https://github.com/VirtoCommerce/vc-community/raw/master/NuGet/icon.png</PackageIconUrl>
<PackageIconUrl>icon.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<Description>Virto Commerce is a flexible B2B ecommerce solution that offers powerful tools for enterprise business users. https://virtocommerce.com</Description>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<!-- Include icon.png from solution root into all packable projects -->
<!-- The file will be packaged at the root of the NuGet package -->
<ItemGroup Condition="'$(IsPackable)' == 'true' AND '$(MSBuildProjectName.Contains(Tests))' == false">
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="icon.png" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Upgrading to Virto Commerce on .NET 10

## Overview

Virto Commerce on NET 10 (3.1000+) introduces a significant technical update by transitioning the platform to .NET 10.
This update focuses on enhancing performance and stability while maintaining backward compatibility.
It involves updating the Target Framework to .NET 10 and integrating the latest LTS releases of third-party libraries.
Importantly, no code refactoring or alterations to the API and internal structure have been made.

The release has undergone extensive testing, including unit, end-to-end, regression, and performance tests to ensure a seamless transition as well as for other stable releases.

## Explore What's New in .NET 10

Discover the exciting features and improvements introduced in .NET 10 to maximize the benefits of the upgrade. Refer to:

* [What's new in NET10](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/overview)
* [What's new in EF 10 Core](https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-10.0/whatsnew)
* [What's new in ASP.NET Core 10](https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-10.0)

## Benefits

### 1. Enhanced Performance

The compiler in .NET 10 includes significant enhancements that improve performance through better code generation and optimization strategies.

### 2. Improved Stability

Stability is a cornerstone of this update. By leveraging the advancements in .NET 10, Virto Commerce offers enhanced system reliability and robustness. This translates to fewer disruptions, improved error handling, and increased overall system stability.

## Virto Commerce Update Path

1. **Install .NET 10:** Begin by ensuring that you have .NET 10 installed on your system. Follow the official installation guidelines to set up the environment for the upgrade: https://dotnet.microsoft.com/en-us/download/dotnet/10.0
2. **Update Virto Commerce Platform to v3.1000 or later**
3. **Update Virto Commerce Modules to latest stable release 12 and later**. We recommend update to Stable 14.

> By default, Virto Commerce Platform on .NET10 are backward compatible with previous platform stable release on .NET8 (3.800+). However, it is recommended to update custom modules to the latest versions to leverage new features and improvements.

## Known Limitations and Breaking Changes

If you find any new breaking changes, submit an question on [Virto Commerce Community](https://www.virtocommerce.org/c/support/12).

### Exception is thrown when applying migrations if there are pending model changes

Starting with EF Core 9.0, if the model has pending changes compared to the last migration an exception is thrown when dotnet ef database update, Migrate or MigrateAsync is called:

The model for context 'DbContext' has pending changes. Add a new migration before updating the database. This exception can be suppressed or logged by passing event ID 'RelationalEventId.PendingModelChangesWarning' to the 'ConfigureWarnings' method in 'DbContext.OnConfiguring' or 'AddDbContext'.

Forgetting to add a new migration after making model changes is a common mistake that can be hard to diagnose in some cases. The new exception ensures that the app's model matches the database after the migrations are applied.

You can find more information about PendingModelChangesWarning warning by [following link](https://www.virtocommerce.org/t/pendingmodelchangeswarning-in-net-10-ef-core-10-what-happened-how-we-diagnosed-it/817).

### Breaking changes in Microsoft.OpenApi

Virto Commerce updated Microsoft.OpenApi from version 1.0.0 to 2.3.0 that includes some breaking changes. You will need to update and rebuild your custom module if you use Microsoft.OpenApi.
You can find more information about Breaking changes in Microsoft.OpenApi by [following link](https://github.com/microsoft/OpenAPI.NET/blob/main/docs/upgrade-guide-2.md).

## Remove BuildHost-net472 and BuildHost-netcore

After update Microsoft.EntityFrameworkCore.Design to 10.x, you will see that your project includes two folders BuildHost-net472 and BuildHost-netcore under obj folder.
These folders are created by Microsoft.EntityFrameworkCore.Design package to support design-time services for different target frameworks.

You can remove these two folders by modifying your .csproj file to include the following PackageReference for Microsoft.EntityFrameworkCore.Design with PrivateAssets set to all:

```xml
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
```

## Update Virto Commerce Platform and Modules to v3.1000+

### Option 1. vc-build Update command

Utilize the vc-build Update command for an automated update. This method streamlines the update process, ensuring that all components are seamlessly transitioned to the new version.

```cmd
vc-build Update -Stable -v 14
```

### Option 2. Update via package.json

If you use package.json file for automated deployment, change versions of the platform and Virto Commerce modules to 3.1000.0+. Based on latest Stable 8 or Edge release strategy.

### Option 3. Manually update

Alternatively, manually download update the platform and modules to version 3.1000+. This method provides more control over the update process, allowing for a step-by-step transition.

## Update Custom Modules

### Prerequsites

1. Install Visual Studio 2026
2. Install Virto Commerce CLI (vc-build)
```cmd
dotnet tool install VirtoCommerce.GlobalTool -g
```
or update
```cmd
dotnet tool update VirtoCommerce.GlobalTool -g
```

2. Install dotnet-ef to version 10.0+:
```cmd
dotnet tool install --global dotnet-ef --version 10.0.0
```
or update
```cmd
dotnet tool update --global dotnet-ef --version 10.0.0
```

## Update Custom Modules

If you develop a custom module, update can be required primary to update .NET dependencies.

### Update Solution to NET8

Download and execute the [vc-net8-update.ps1 Power Shell script](vc-net10-update.ps1) in your solution folder.

!!! info "How to enable execution of PowerShell scripts"
Set powershell script as trusted if required, by running this power shell command:
```ps1
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
```


```ps1
./vc-net10-update.ps1
```

![step1 run ps1 script](../../media/updatenet10-step1-run-ps1-script.png)

![step2 run ps1 script result](../../media/updatenetStable relea-step2-ps1-script-result.png)

This script automates several these tasks, including (of course you can do it manually):

1. Updating the Target Framework to .NET 10 for every project.
2. Updating project dependencies, including Microsoft NuGet dependencies to version 10.0.0 and VirtoCommerce NuGet dependency to version 3.1000.0 and latest.
3. Updating other third-party dependencies to save version that used by Virto Commerce Platform.
4. Updating the module.manifest file to align with the changes in .NET 10.

![step3 review modified files](../../media/updatenetStable relea-step3-modified-files.png)

### Build Solution

1. Build the solution and meticulously address any compilation errors and warnings if required. This step ensures that the solution is compatible with the updated framework.
2. Verify Tests for Issues Perform a thorough verification of tests to identify and address any issues introduced by the update. This step guarantees that the updated solution maintains the expected functionality and performance.

![step3 build solution](../../media/updatenetStable relea-step4-build.png)

### Create Module Package

Generate a module package by running vc-build Compress. This step finalizes the update process, creating a package that encapsulates the updated modules for deployment.

```cmd
vc-build Compress
```

## Run and Enjoy Virto Commerce on .NET 10

With the update process completed, you can now run and enjoy the enhanced capabilities of Virto Commerce on the .NET 10 platform.
Explore the platform's new features and optimizations to leverage its full potential for a resilient and efficient e-commerce solution.

192 changes: 192 additions & 0 deletions docs/release-information/update-to-version-3-1000/vc-net10-update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Define the target framework
$targetFramework = "net10.0"
$versionPrefix = "3.1000.0"
$platformVersion = "3.1000.0"

# Read the predefined versions from vc-references.json or create an empty object
$predefinedVersions = @{
"AutoFixture" = "4.18.1"
"coverlet.collector" = "6.0.4"
"FluentAssertions" = "8.8.0"
"FluentValidation" = "12.1.0"
"Hangfire" = "1.8.22"
"Microsoft.AspNetCore.Authentication.OpenIdConnect" = "10.0.0"
"Microsoft.AspNetCore.Mvc.NewtonsoftJson" = "10.0.0"
"Microsoft.EntityFrameworkCore" = "10.0.0"
"Microsoft.EntityFrameworkCore.Design" = "10.0.0"
"Microsoft.EntityFrameworkCore.InMemory" = "10.0.0"
"Microsoft.EntityFrameworkCore.Relational" = "10.0.0"
"Microsoft.EntityFrameworkCore.SqlServer" = "10.0.0"
"Microsoft.EntityFrameworkCore.Tools" = "10.0.0"
"Microsoft.Extensions.Configuration.UserSecrets" = "10.0.0"
"Microsoft.Extensions.DependencyModel" = "10.0.0"
"Microsoft.Extensions.Logging.Abstractions" = "10.0.0"
"Microsoft.NET.Test.Sdk" = "18.0.1"
"Microsoft.SourceLink.GitHub" = "8.0.0"
"MockQueryable.Moq" = "10.0.0"
"Moq" = "4.20.72"
"Npgsql" = "10.0.0"
"Npgsql.EntityFrameworkCore.PostgreSQL" = "10.0.0"
"OpenIddict.AspNetCore" = "7.2.0"
"OpenIddict.EntityFrameworkCore" = "7.2.0"
"Polly" = "9.0.0"
"Pomelo.EntityFrameworkCore.MySql" = "9.0.0"
"Swashbuckle.AspNetCore.SwaggerGen" = "10.0.1"
"xunit" = "2.9.3"
"xunit.runner.visualstudio" = "3.1.5"
}

function Save-File ($xml, $filePath) {
$utf8WithoutBom = New-Object System.Text.UTF8Encoding($false)
Write-Host ("filename: " + $filePath)
$xmlWriterSettings = New-Object System.Xml.XmlWriterSettings
$xmlWriterSettings.Indent = $true
$xmlWriterSettings.Encoding = $utf8WithoutBom
$xmlWriterSettings.OmitXmlDeclaration = $filePath.EndsWith(".csproj")

$xmlWriter = [System.Xml.XmlWriter]::Create($filePath, $xmlWriterSettings)
$xml.Save($xmlWriter)
$xmlWriter.Close()
# Add-Content -Path $filePath -Value "`n"
}

function Load-File($filePath) {
$xmlDoc = New-Object System.Xml.XmlDocument
$xmlDoc.PreserveWhitespace = $true
$xmlDoc.Load($filePath)
return $xmlDoc
}

function Display-Version-Change ($moduleName, $oldVersion, $newVersion) {
Write-Host "$(($moduleName + ":").PadRight(60, ' ')) $($oldVersion.PadLeft(30, ' ')) ==> $($newVersion)"
}

# Function to update PackageReference version
function Update-PackageReference ($projectFile, $packageName, $version) {
$xml = [xml](Load-File $projectFile)
$packageReference = $xml.Project.ItemGroup.PackageReference | Where-Object { $_.Include -eq $packageName }

if ($packageReference -ne $null) {
$packageReference.Version = $version
Save-File $xml $projectFile
}
}

# Function to update TargetFramework
function Update-TargetFramework ($projectFile, $targetFramework) {
$xml = [xml](Load-File $projectFile)

# Find the first PropertyGroup containing TargetFramework or create one
$propertyGroup = $xml.Project.PropertyGroup | Where-Object { $_.TargetFramework -ne $null } | Select-Object -First 1

# Update or create TargetFramework element
$targetFrameworkElement = $propertyGroup.SelectSingleNode("TargetFramework")

# Update the InnerText of TargetFramework
$targetFrameworkElement.InnerText = $targetFramework
Save-File $xml $projectFile
}

# Function to update packages to the latest version
function Update-Latest-Packages ($projectFile) {
$xml = [xml](Load-File $projectFile)

$xml.Project.ItemGroup.PackageReference | Where-Object { $_.Version -ne $null } | ForEach-Object {
$packageName = $_.Include
$installedVersion = $_.Version
$item = $_

$version = $predefinedVersions.$packageName
if (-not $version) {
try {
$latestVersion = (Find-Package $packageName -Source https://www.nuget.org/api/v2).Version

if ($packageName.StartsWith("VirtoCommerce") -or ($versionPrefix.Contains("alpha") -or [System.Version]$versionPrefix -gt [System.Version]$latestVersion)) {
$latestVersion = $versionPrefix
}
$predefinedVersions["$packageName"] = $latestVersion
$version = $latestVersion
} catch {
# ignore beta versions
}
}

$_.Version = $version

Display-Version-Change $packageName $installedVersion $version
}

Save-File $xml $projectFile
}

# Function to find all .csproj files in a folder and its subfolders
function Find-Csproj-Files ($folder) {
Get-ChildItem -Path $folder -Recurse -Filter *.csproj | Where-Object { $_.Extension -eq '.csproj' }
}

function Find-File($folder, $fileName) {
$file = Get-ChildItem -Path $folder -Recurse -Filter $fileName | Select-Object -First 1
return $file
}

# Function
function Update-Directory-Build-Props($directoryBuildPropsFile)
{
$xml = [xml](Load-File $directoryBuildPropsFile)

$versionPrefixPropertyGroup = $xml.Project.PropertyGroup | Where-Object { $_.VersionPrefix -ne $null } | Select-Object -First 1
$VersionPrefixElement = $versionPrefixPropertyGroup.SelectSingleNode("VersionPrefix")
$VersionPrefixElement.InnerText = $versionPrefix

Save-File $xml $directoryBuildPropsFile
}

# Function
function Update-Module-Manifest($moduleManifestFile) {
# it's better to load https://raw.githubusercontent.com/VirtoCommerce/vc-modules/master/modules_v3_net8.json and get latest version there

$xml = [xml](Load-File $moduleManifestFile)

$xml.module.version = $versionPrefix
$xml.module.platformVersion = $platformVersion

$dependencies = $xml.GetElementsByTagName("dependency")
foreach ($dependency in $dependencies) {
$newVersion = "3.1000.0"
Display-Version-Change $dependency.id $dependency.version $newVersion
$dependency.SetAttribute("version", $newVersion)
}

Save-File $xml $moduleManifestFile
}

# Main script
$repFolder = "."
$srcFolder = "src"
$csprojFiles = Find-Csproj-Files $repFolder

foreach ($csprojFile in $csprojFiles) {
Write-Host """$($csprojFile.Name)""" -ForegroundColor Yellow

# Step 1: Change TargetFramework
Write-Host "Updating TargetFramework"
Update-TargetFramework $csprojFile.FullName $targetFramework

# Step 2: Update packages to the latest version
Write-Host "Updating other packages to the latest version"
Update-Latest-Packages $csprojFile.FullName
}

# Step 3: Update packages to the latest version
Write-Host "Updating Directory.Build.props"
$directoryBuildPropsFile = Find-File $repFolder "Directory.Build.props"
Update-Directory-Build-Props $directoryBuildPropsFile.FullName


# Step 3: Update module.manifest to the latest version
Write-Host "Updating module.manifest"
$moduleManifestFile = Find-File $srcFolder "module.manifest"
Update-Module-Manifest $moduleManifestFile.FullName


Write-Host "Script completed successfully."
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading