Closed cheesi closed 2 years ago
We are facing same issue, .NET Framework 4.7.2, xUnit 2.4.1
Microsoft.Build.Exceptions.InvalidProjectFileException: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. C:\My\Dev\STS\aronal.devicesequences\packages\coverlet.collector.3.0.3\build\netstandard1.0\coverlet.collector.targets at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1,T2](Boolean condition, String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1) at Microsoft.Build.Evaluation.Expander
2.Function1.Execute(Object objectInstance, IPropertyProvider
1 properties, ExpanderOptions options, IElementLocation elementLocation)
at Microsoft.Build.Evaluation.Expander2.PropertyExpander
1.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander
2.PropertyExpander1.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider
1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem)
at Microsoft.Build.Evaluation.Expander2.PropertyExpander
1.ExpandPropertiesLeaveEscaped(String expression, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander
2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation)
at Microsoft.Build.Evaluation.ConditionEvaluator.ConditionEvaluationState2.ExpandIntoString(String expression) at Microsoft.Build.Evaluation.StringExpressionNode.GetExpandedValue(IConditionEvaluationState state) at Microsoft.Build.Evaluation.StringExpressionNode.ShouldBeTreatedAsVisualStudioVersion(IConditionEvaluationState state) at Microsoft.Build.Evaluation.StringExpressionNode.CanNumericEvaluate(IConditionEvaluationState state) at Microsoft.Build.Evaluation.NumericComparisonExpressionNode.BoolEvaluate(IConditionEvaluationState state) at Microsoft.Build.Evaluation.GenericExpressionNode.Evaluate(IConditionEvaluationState state) at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateConditionCollectingConditionedProperties[P,I](String condition, ParserOptions options, Expander
2 expander, ExpanderOptions expanderOptions, Dictionary2 conditionedPropertiesTable, String evaluationDirectory, ElementLocation elementLocation, ILoggingService loggingServices, BuildEventContext buildEventContext, IFileSystem fileSystem, ProjectRootElementCacheBase projectRootElementCache) at Microsoft.Build.Evaluation.Evaluator
4.EvaluateConditionCollectingConditionedProperties(ProjectElement element, String condition, ExpanderOptions expanderOptions, ParserOptions parserOptions, ProjectRootElementCacheBase projectRootElementCache)
at Microsoft.Build.Evaluation.Evaluator4.EvaluatePropertyElement(ProjectPropertyElement propertyElement) at Microsoft.Build.Evaluation.Evaluator
4.EvaluatePropertyGroupElement(ProjectPropertyGroupElement propertyGroupElement)
at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator
4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator
4.Evaluate()
at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData
4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory
2 itemFactory, IToolsetProvider toolsetProvider, 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.ReevaluateIfNecessary(EvaluationContext evaluationContext)
at NuGet.PackageManagement.VisualStudio.MicrosoftBuildEvaluationProjectUtility.AddImportStatement(Project msBuildProject, String targetsPath, ImportLocation location)
at NuGet.PackageManagement.VisualStudio.VsMSBuildProjectSystem.AddImportStatement(String targetsPath, ImportLocation location)
at NuGet.PackageManagement.VisualStudio.VsMSBuildProjectSystem.<>cDisplayClass35_0.<
That's actually something good, I already thought, I was alone with this problem. Zero hits on Google and StackOverflow. So this seems like a bug, that's actually reproducible.
I think it is because of the Project type - Non SDK, would be nice if there is workaround for those not supported project types.
Hi guys...coverlet supports only SDK-style project https://github.com/coverlet-coverage/coverlet#quick-start
Can you migrate to it? If you're on SDK-style and doesn't work could be good provide a repro.
Unfortunately we have many .Net Framework repos with non-sdk style projects and we are not able to migrate them as they are in production. We have to select another tool. Do you plan support for such repos?
Do you plan support for such repos?
No at the moment we don't think to support it.
we are not able to migrate them as they are in production.
Why? it's not a change that break or non compat with production, sdk style is supported by msbuild/visual studio/dotnet core, the outcome won't change. I mean migrate the project csproj style is not migrate to new runtime. You'll get a lot of benefits, first of all https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets
One way I got around this issue was by renaming (or deleting) the coverlet.collector
directory in your $HOME\.nuget\packages
directory. Close Visual Studio completely, then re-open your solution or project.
Close as-designed, feel free to reopen if needed.
Is there a tool to convert an existing project to the new SDK format? Creating a new .NET Framework Unit Test project in VS 2022 17.2 creates an old-style project in its template.
I'm not even trying to use coverlet in the .NET Framework project I'm trying to upgrade. I have a whole separate .NET Core project using SDK Style which pulled coverlet in, but then that's breaking the existing .NET Framework project that's sharing the same files in the same directory to test .NET Framework and .NET Core side-by-side.
So just by the mere addition of the .NET Core Unit Test project referencing coverlet in the solution, the .NET Framework project refuses to build properly now.
Edit: If I moved the .NET Core project to a separate directory (and then just changed all the paths for it to reference from the .NET Framework project in the sister directory) so that it didn't share the same obj/bin folders, then it seems to be working better. Lots of Link
magic involved with that though.
@hawkerm this fella works:
When I install the coverlet.msbuild nuget package on a existing NUnit test application, I get the following error:
It looks like https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.msbuild.tasks/coverlet.msbuild.targets#L11 is the reason for this message.
We are using .NET Framework 4.7.2 for this project. The testing framework is NUnit 3.12.0
Any idea on how to fix this issue?