-
-
Notifications
You must be signed in to change notification settings - Fork 22
add .net 8 support, remove netcore3.1 support #89
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
Conversation
@leonardochaia I'm not sure this is all that is needed, tests and such pass locally for me now but I have several .NET SDKs installed so I might have missed something. |
@leonardochaia well that didn't go to well, are you ok with dropping netcoreapp3.1 as a target since that is apparently no longer supported or this an important target to still honor? |
Hi @tanordheim , thanks for the PR! I really really appreciate it!! 🥇 netcoreapp3.1 can definitively be removed, if someone still using it wants to use dotnet-affected they can use an older version. If you encounter any issues let me know and I may find some time during the weekend to take a look! Thank you!! |
No worries, @leonardochaia, love the project. We just started using it in one of our monorepos and it simplified so many things for us :) I've pushed a commit now that removes netcore3.1 target support. There is a couple of things I'm unsure of so I'll add PR comments for those so we can discuss with some context. |
@@ -265,6 +265,7 @@ In most cases it is automatically resolved using the following logic: | |||
- If >= `17.0.0` it will resolve to `net6.0` | |||
- Else if >= `16.11.0` it will resolve to `net5.0` | |||
- Else it will resolve to `netcoreapp3.1` | |||
- TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how true this list is at the moment, I'm not that intimately familiar with how all of this stuff works. How would you suggest I change this?
var projectRootElement = CreateProjectRootElement(projectRootElementFilePath); | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running these tests locally I more or less always (but I have also seen it succeed I think) get this error for the net8.0
target. All other targets pass just fine:
Microsoft.Build.Exceptions.InvalidProjectFileException
A numeric comparison was attempted on "$(_TargetFrameworkVersionWithoutV)" that evaluates to "" instead of a number, in condition "'$(PublishRelease)' == '' and '$(_TargetFrameworkVersionWithoutV)' >= '8.0'". /usr/local/share/dotnet/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1,T2,T3](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1, T3 arg2)
at Microsoft.Build.Evaluation.NumericComparisonExpressionNode.BoolEvaluate(IConditionEvaluationState state, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.AndExpressionNode.BoolEvaluate(IConditionEvaluationState state, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.OperatorExpressionNode.TryBoolEvaluate(IConditionEvaluationState state, Boolean& result, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.GenericExpressionNode.Evaluate(IConditionEvaluationState state, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateConditionCollectingConditionedProperties[P,I](String condition, ParserOptions options, Expander`2 expander, ExpanderOptions expanderOptions, Dictionary`2 conditionedPropertiesTable, String evaluationDirectory, ElementLocation elementLocation, ILoggingService loggingServices, BuildEventContext buildEventContext, IFileSystem fileSystem, ProjectRootElementCacheBase projectRootElementCache, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateConditionCollectingConditionedProperties(ProjectElement element, String condition, ExpanderOptions expanderOptions, ParserOptions parserOptions, ProjectRootElementCacheBase projectRootElementCache)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluatePropertyGroupElement(ProjectPropertyGroupElement propertyGroupElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, IDirectoryCacheFactory directoryCacheFactory, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, Boolean interactive)
at Microsoft.Build.Evaluation.Project.FromProjectRootElement(ProjectRootElement rootElement, ProjectOptions options)
at DotnetAffected.Core.ProjectFactory.CreateProject(String projectRootElementFilePath) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/ProjectFactory.cs:line 48
at DotnetAffected.Core.FileSystem.EagerCachingMsBuildGitFileSystem.CreateProjectAndEagerLoadChildren(String path) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/FileSystem/EagerCachingMsBuildGitFileSystem.cs:line 49
at DotnetAffected.Core.GitChangesProvider.LoadProjectCore(String directory, String pathToFile, String commitRef, Boolean fallbackToHead) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/GitChangesProvider.cs:line 73
at DotnetAffected.Core.GitChangesProvider.LoadProject(String directory, String pathToFile, String commitRef, Boolean fallbackToHead) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/GitChangesProvider.cs:line 49
at DotnetAffected.Core.Processor.AffectedProcessor.FindChangedNugetPackages(AffectedProcessorContext context) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/Processor/AffectedProcessor.cs:line 114
at DotnetAffected.Core.Processor.AffectedProcessor.DiscoverPackageChanges(AffectedProcessorContext context) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/Processor/AffectedProcessor.cs:line 30
at DotnetAffected.Core.Processor.AffectedProcessorBase.Process(AffectedProcessorContext context) in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/Processor/AffectedProcessorBase.cs:line 33
at DotnetAffected.Core.AffectedExecutor.Execute() in /Users/trond/Code/dotnet-affected/src/DotnetAffected.Core/AffectedExecutor.cs:line 41
at DotnetAffected.Core.Tests.BaseDotnetAffectedTest.<.ctor>b__1_0() in /Users/trond/Code/dotnet-affected/test/DotnetAffected.Core.Tests/Utils/BaseDotnetAffectedTest.cs:line 16
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at DotnetAffected.Core.Tests.BaseDotnetAffectedTest.get_AffectedSummary() in /Users/trond/Code/dotnet-affected/test/DotnetAffected.Core.Tests/Utils/BaseDotnetAffectedTest.cs:line 24
at DotnetAffected.Core.Tests.CentralPackageManagementDetectionNestedTests.When_directory_packages_props_changes_without_dependant_projects_nothing_should_be_affected() in /Users/trond/Code/dotnet-affected/test/DotnetAffected.Core.Tests/CentralPackageManagementDetectionNestedTests.cs:line 137
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
I'm not sure why this only fails on net8.0
and not net6.0
and net7.0
. What seems to solve it is to add this to the ProjectOptions
below:
new ProjectOptions
{
GlobalProperties = new Dictionary<string, string>{ {"TargetFramework", "net8.0"} },
// ... existing ProjectOptions
}
The tests for non-net8.0
frameworks still pass with this in place but I'm not sure this is the correct fix. Any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tanordheim , as you pointed out they were failing due to missing TargetFramework
.
I've added it in the sample project generation in tests and that seems to work
Great stuff! I thought I'd look at the open issue surrounding deleted files over the weekend as well so if you want to hold off a few days cutting a new release we could maybe get that one included at the same time 🙂 |
Ahh yeah that would be amazing! Thanks bud! |
Given that the handling of deleted files proved to be a bit more complicated than I thought, as you also commented on that issue, would you be up for releasing a new version with .NET 8 support as we work that out? Would love to test this out! |
This is an attempt to add support for .NET 8 to the tool, as it does not run if only .NET 8 SDKs are installed:
As of .NET 8,
netcore3.1
is no longer a valid target so support for that has been dropped: