Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MSBuild from VS2022 instead of VS2019 #133

Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
push:
branches:
- develop
- release_7*
- release_*
tags:
- v*

pull_request:
branches:
- develop
- release_7*
- release_*

jobs:
build:
name: Build
runs-on: windows-2019
# info about windows-2019 https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
runs-on: windows-latest
# info about windows-latest https://github.com/actions/runner-images
env:
DROP_DIR: drop
steps:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ For more Service Fabric open source projects, visit the Service Fabric [home rep
## Getting Started

### Prerequesites
Each project is a normal C# Visual Studio 2019 project. At minimum, you need [MSBuild 16](https://docs.microsoft.com/visualstudio/msbuild/whats-new-msbuild-16-0), [PowerShell](https://msdn.microsoft.com/powershell/mt173057.aspx), [.NET Core SDK](https://www.microsoft.com/net/download/windows) and [.NET Framework 4.6](https://www.microsoft.com/en-US/download/details.aspx?id=48130) to build and generate NuGet packages.
Each project is a normal C# Visual Studio 2022 project. At minimum, you need [MSBuild 17](https://learn.microsoft.com/en-us/visualstudio/msbuild/whats-new-msbuild-17-0?view=vs-2022), [PowerShell](https://msdn.microsoft.com/powershell/mt173057.aspx), [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) and [.NET Framework 4.6](https://www.microsoft.com/en-US/download/details.aspx?id=48130) to build and generate NuGet packages.

We recommend installing [Visual Studio 2019](https://www.visualstudio.com/vs/) which will set you up with all the .NET build tools and allow you to open the solution files. Community Edition is free and can be used to build everything here.
We recommend installing [Visual Studio 2022](https://www.visualstudio.com/vs/) which will set you up with all the .NET build tools and allow you to open the solution files. Community Edition is free and can be used to build everything here.

### Build
To build everything and generate NuGet packages, run the **build.ps1** script. NuGet packages and PowerShell module will be dropped in a *drop* directory at the repo root.
Expand Down
37 changes: 16 additions & 21 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param
#Options are:
# RebuildAll: Clean, Build all .csproj and Generate Nuget Packages. This is the default option.
# BuildAll: Build all .csproj and Generate Nuget Packages.
# BuildCode: Builds code, doesn't generates nuget packages.
# BuildCode: Builds code, doesn't generates nuget packages.
# GeneratePackages: Generates nuget packages, this target doesn't builds code, build must be done using BuildCode target before invoking this target.
[ValidateSet('Rebuildall', 'BuildAll', 'BuildCode', 'GeneratePackages')]
[string]$Target = "RebuildAll",
Expand All @@ -33,36 +33,31 @@ if($MSBuildFullPath -ne "")
}
}

# msbuild path not provided, find msbuild for VS2019
# msbuild path not provided, find msbuild for VS2022
if($MSBuildFullPath -eq "")
{
if (Test-Path "env:\ProgramFiles(x86)")
$progFilesPaths = ${env:\ProgramFiles(x86)}, ${env:\ProgramFiles}
foreach ($progFilesPath in $progFilesPaths)
{
$progFilesPath = ${env:ProgramFiles(x86)}
}
elseif (Test-Path "env:\ProgramFiles")
{
$progFilesPath = ${env:ProgramFiles}
}

$VS2019InstallPath = join-path $progFilesPath "Microsoft Visual Studio\2019"
$versions = 'Community', 'Professional', 'Enterprise'
$VS2022InstallPath = join-path $progFilesPath "Microsoft Visual Studio\2022"
$versions = 'Preview', 'Community', 'Professional', 'Enterprise'

foreach ($version in $versions)
{
$VS2019VersionPath = join-path $VS2019InstallPath $version
$MSBuildFullPath = join-path $VS2019VersionPath "MSBuild\Current\Bin\MSBuild.exe"

if (Test-Path $MSBuildFullPath)
foreach ($version in $versions)
{
break
$VS2022VersionPath = join-path $VS2022InstallPath $version
$testPath = join-path $VS2022VersionPath "MSBuild\Current\Bin\MSBuild.exe"

if (Test-Path $testPath)
{
$MSBuildFullPath = $testPath
}
}
}
}

if (!(Test-Path $MSBuildFullPath))
if (($MSBuildFullPath -eq "") -or !(Test-Path $MSBuildFullPath))
{
throw "Unable to find MSBuild installed on this machine. Please install Visual Studio 2019 or if its installed at non-default location, provide the full ppath to msbuild using -MSBuildFullPath parameter."
throw "Unable to find MSBuild installed on this machine. Please install Visual Studio 2022 or if its installed at non-default location, provide the full path to msbuild using -MSBuildFullPath parameter."
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Title>Microsoft.ServiceFabric.Client.Http</Title>
<Description>This package contains the reference assemblies for connecting to Service Fabric cluster over Http and performing operations to create and manage micro-services.</Description>
<Summary>This package contains the reference assemblies for connecting to Service Fabric cluster over Http and performing operations to create and manage micro-services.</Summary>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
</PropertyGroup>

<Import Project="$(NuProjPath)\NuProj.props" />
Expand Down
1 change: 1 addition & 0 deletions nuprojs/SF.ClientLib.Internal/SF.ClientLib.Internal.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Summary>This package provides Service Fabric Actors and Services libraries for consumption by other Service Fabric repos.</Summary>
<Tags>ServiceFabric Microsoft Azure Fabric</Tags>
<NoPackageAnalysis>true</NoPackageAnalysis>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
</PropertyGroup>

<Import Project="$(NuProjPath)\NuProj.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Summary>This package provides Service Fabric Actors and Services libraries for consumption by other Service Fabric repos.</Summary>
<Tags>ServiceFabric Microsoft Azure Fabric</Tags>
<NoPackageAnalysis>true</NoPackageAnalysis>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
</PropertyGroup>

<Import Project="$(NuProjPath)\NuProj.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.59.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0-preview-06" />
<PackageReference Include="YamlDotNet.Signed" Version="5.2.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.59.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="System.Management.Automation.dll" Version="10.0.10586" />
<PackageReference Include="YamlDotNet.Signed" Version="5.2.1" />
</ItemGroup>
Expand Down