My solution using PowerShell 7
You need to create a PowerShell script inside of project folder, for this example is "PostBuild.ps1". This script will be called in PostbuildEvents property.
For MsBuild properties
https://learn.microsoft.com/es-es/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022
Download Powershell
https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3
First Solution Reading the Project'XML and retrieving the properties.
Your project files

Your project XML
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Company>Acme</Company>
<Product>NextBigThing</Product>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="pwsh -NoLogo -ExecutionPolicy Bypass -Command "./PostBuild.ps1 -ProjectFileName $(ProjectFileName)"" />
</Target>
</Project>

Your project properties - Visual studio
The command to call "PostBuild.ps1" is
pwsh -NoLogo -ExecutionPolicy Bypass -Command "./PostBuild.ps1 -ProjectFileName $(ProjectFileName)"

PostBuild.ps1 - Code
[CmdletBinding()]
param (
[Parameter()]
[string]
$ProjectFileName
)
Write-Host "█ ProjectFileName from parameters: $ProjectFileName"
$basePath = "//Project/PropertyGroup"
$companyLabel = "Company"
$productLabel = "Product"
if (!(Test-Path $ProjectFileName -PathType Leaf) -or (!"$ProjectFileName".EndsWith(".csproj"))) {
throw "Invalid file `"$ProjectFileName`"."
}
[System.Xml.XmlDocument] $doc = [System.Xml.XmlDocument]::new()
$doc.PreserveWhitespace = $true
$doc.Load($ProjectFilename)
$company = $doc.DocumentElement.SelectSingleNode("$basePath/$companyLabel").InnerText
$product = $doc.DocumentElement.SelectSingleNode("$basePath/$productLabel").InnerText
Write-Host "█ command: xcopy ""$PSScriptRoot"" ""%AppData%\$company\$product\"""
Output
1>------ Rebuild All started: Project: VariablesInPostBuildEvents, Configuration: Debug Any CPU ------
Restored C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents\VariablesInPostBuildEvents.csproj (in 3 ms).
1>VariablesInPostBuildEvents -> C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents\bin\Debug\net7.0\VariablesInPostBuildEvents.dll
1>█ ProjectFileName from parameters: VariablesInPostBuildEvents.csproj
1>█ command: xcopy "C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents" "%AppData%\Acme\NextBigThing\"
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 00:01.628 ==========

Second Solution Company and Product are MSBuild known properties. It can be included in command.
Same file structure
Command in PostBuildEvents
pwsh -NoLogo -ExecutionPolicy Bypass -Command "./PostBuild.ps1 -Company $(Company) -Product $(Product)"
PostBuild.ps1
[CmdletBinding()]
param (
[Parameter()]
[string]
$Company,
[Parameter()]
[string]
$Product
)
Write-Host "█ Company: $Company"
Write-Host "█ Company: $Product"
Write-Host "█ command: xcopy ""$PSScriptRoot"" ""%AppData%\$company\$product\"""
Output
Rebuild started...
1>------ Rebuild All started: Project: VariablesInPostBuildEvents, Configuration: Debug Any CPU ------
Restored C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents\VariablesInPostBuildEvents.csproj (in 2 ms).
1>VariablesInPostBuildEvents -> C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents\bin\Debug\net7.0\VariablesInPostBuildEvents.dll
1>█ Company: Acme
1>█ Company: NextBigThing
1>█ command: xcopy "C:\Users\Megam\Desktop\so an\VariablesInPostBuildEvents" "%AppData%\Acme\NextBigThing\"
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 00:02.728 ==========
