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

Update Directory.Build.props with newer version of packages for .NET 8 and 7 build #2272

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

seesharprun
Copy link
Contributor

@seesharprun seesharprun commented Nov 30, 2023

TLDR: Can't build Oryx in a devcontainer with .NET 7 and .NET 8 installed side-by-side

Bug Report

I'm attempting to update the devcontainers/images universal image to support .NET 8, but it's running into an issue where Oryx will not build (dotnet build oryx.sln) if a new version of .NET is installed.

Even in an isolated environment with .NET 7 and .NET 8, building Oryx runs into the following error:

dotnet build --configuration Debug --framework net7.0 Oryx.sln
Build FAILED.

C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\build\tools\SharedCodeGenerator\S
haredCodeGenerator.csproj]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\build\tools\Automation\Automation
.csproj]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\src\BuildServer\BuildServer.cspro
j]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\src\Oryx.Common\Common.csproj]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\src\BuildScriptGenerator.Common\B
uildScriptGenerator.Common.csproj]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\src\Detector\Detector.csproj]
C:\Users\sidandrews\.nuget\packages\microsoft.codeanalysis.netanalyzers\7.0.0\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(593,5): warning : The .NET SDK has newer analyzers with version '8.0.0
' than what version '7.0.0' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference. [C:\Users\sidandrews\Demos\oryx-real\src\BuildScriptGenerator\BuildScr
iptGenerator.csproj]
CSC : error CS9057: The analyzer assembly 'C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.NET.Sdk.Razor.SourceGenerators.dll' references version '4.8.0.
0' of the compiler, which is newer than the currently running version '4.6.0.0'. [C:\Users\sidandrews\Demos\oryx-real\src\BuildServer\BuildServer.csproj]
    7 Warning(s)
    1 Error(s)

I was able to reproduce this issue in a blank GitHub codespace, on my local machine (with .NET 6, 7, and 8) and as part of the smoke test build for Oryx in the devcontainer/images repo.

Solution

I'm able to unblock this by changing the Directory.Build.props file to use a newer version of the Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.CodeAnalysis.Compilers, and Microsoft.Net.Compilers.Toolset packages.

This PR updates the project to use newer versions of the package so you can build Oryx in an environment with just .NET 7 or in an environment with both .NET 7 and .NET 8.

Related

This resolves:

@seesharprun seesharprun marked this pull request as ready for review November 30, 2023 02:25
@seesharprun seesharprun requested a review from a team as a code owner November 30, 2023 02:25
@samruddhikhandale
Copy link
Member

Hi @seesharprun, can you merge the latest from main to your branch so that the Oryx team can kick off an Oryx validation/nightly?

@seesharprun
Copy link
Contributor Author

Done

@samruddhikhandale
Copy link
Member

Thanks @seesharprun

@pauld-msft The author has updated this PR, can you help take over this PR and help merge this if it looks good? Thanks! // cc @william-msft

@pauld-msft
Copy link
Member

@samruddhikhandale @seesharprun Thanks. Confirmed that I can now kick off the validation / nightly pipelines. Depending on the pipeline fix, may need to perform the merge one more time to pull in those changes. This should help us confirm that we don't run into any separate issues with the pipelines

@samruddhikhandale
Copy link
Member

@samruddhikhandale @seesharprun Thanks. Confirmed that I can now kick off the validation / nightly pipelines. Depending on the pipeline fix, may need to perform the merge one more time to pull in those changes. This should help us confirm that we don't run into any separate issues with the pipelines

@pauld-msft @william-msft Wondering if we have any updates on this one ^, thanks!

@samruddhikhandale
Copy link
Member

Hi @seesharprun, can you merge the latest from main to your branch so that the Oryx team can kick off an Oryx validation/nightly?

@seesharprun mind doing the same thing, again? Thanks! Looks like the Oryx pipelines are now working.

@seesharprun
Copy link
Contributor Author

Done

@pauld-msft
Copy link
Member

kicked off the tests again, thanks for following up

@samruddhikhandale
Copy link
Member

Thank you @pauld-msft, let us know if it's ready to be merged.

@daniv-msft daniv-msft merged commit 7207989 into microsoft:main Jan 30, 2024
1 check passed
@seesharprun seesharprun deleted the update-build-props branch January 31, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants