Error MSB4184: The expression "[MSBuild]::VersionGreaterThanOrEquals('', 8.0)" cannot be evaluated. Version string was not in a correct format.
mayadav1 opened this issue · comments
Getting Error while running ap.net benchmarks with sdk version "8.0.100-preview.5.23261.2". Not observed error with previous version of sdk.
Command:
dotnet publish Benchmarks.csproj -c Release -o C:\Users\mayadav1\AppData\Local\Temp\2\benchmarks-agent\benchmarks-server-6712\iskticrn.2rf\benchmarks\src\Benchmarks\published /p:MicrosoftNETCoreAppPackageVersion=8.0.0-preview.5.23260.3 /p:MicrosoftAspNetCoreAppPackageVersion=8.0.0-preview.5.23260.10 /p:GenerateErrorForMissingTargetingPacks=false /p:RestoreNoCache=true /p:MicrosoftWindowsDesktopAppPackageVersion=8.0.0-preview.5.23260.3 /p:MicrosoftNETPlatformLibrary=Microsoft.NETCore.App --framework net8.0 --self-contained -r win-x64
Error :
MSBuild version 17.7.0-preview-23260-01+7f4bef8b4 for .NET
C:\Users\mayadav1\AppData\Local\Temp\2\benchmarks-agent\benchmarks-server-6712\gvg14grl.1n3\sdk\8.0.100-preview.5.23261.2\Containers\build\Microsoft.NET.Build.Containers.targets(14,5): error MSB4184: The expression "[MSBuild]::VersionGreaterThanOrEquals('', 8.0)" cannot be evaluated. Version string was not in a correct format. [C:\Users\mayadav1\AppData\Local\Temp\2\benchmarks-agent\benchmarks-server-6712\iskticrn.2rf\benchmarks\src\Benchmarks\Benchmarks.csproj]
Please help in finding solution . your help will be appreciate. I found one PR for same issue "dotnet/msbuild#8148".
That implies that the $(NetCoreSdkVersion)
property isn't set during this operation, which it should be for all SDKs. Can you get a binlog @mayadav1?
@baronfel File type doesn't support . I am changing type of file for being now .txt. you can modify later . I hope that works too.
mystep.txt
This is bizarre - @mayadav1 in your binlog I can see that the file that defines NETCoreSdkVersion
is imported (the file is Microsoft.NETCoreSdk.BundledVersions.props
, which is part of the .NET SDK), but no properties from it are set on the project you're building. I honestly wouldn't expect anything at all to work if properties aren't being set. @rainersigwald have you ever seen this kind of behavior before?
@baronfel @rainersigwald , This is specific to sdk version 8.0.100-preview.5.23261.3, sdk previous version preview1 works good for me . Am I providing incorrect info to build ?
It's not $(NetCoreSdkVersion)
that's undefined, it's $(TargetFrameworkVersion)
. Looks like the import order is now pulling Microsoft.NET.Build.Containers.targets
in before the SDK targets that decompose the TF.
@mayadav1 try setting -p:EnableSdkContainerSupport=false
on the command line, that should get you past this.
Thanks for being able to read better than I can @rainersigwald - I'll assign this to the containers area for the team to fix ASAP. I wonder why this didn't surface in unit/integration tests?
Thank you @baronfel @rainersigwald . I appreciate your help. I am not sure what is a correct implementation but your suggestion works for me.
FYI: I've came across the same issue when trying to build https://github.com/OrchardCMS/OrchardCore using sdk v8.0.100-preview.5.23261.17
Hello I still have this problem on the latest update for VS 2022, its not fixed. I pasted the project file.. and trimmed some extra stuff to make it readable
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{....}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>Sandbox2.WorkflowXX.ABCD</AssemblyName>
<TargetFrameworkVersion>net7.0</TargetFrameworkVersion>
<ApplicationVersion>1.2</ApplicationVersion>
<FileAlignment>512</FileAlignment>
<RootNamespace>Sandbox2</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sandbox2.Models" />
<Reference Include="Sandbox2.MonitorTrace">
<HintPath>lib\Sandbox2.Widget.dll</HintPath>
</Reference>
<Reference Include="Sandbox2.Workflow" />
<Reference Include="Sandbox2.Migration.Custom" />
<Reference Include="Sandbox2.Drawing" />
<Reference Include="Sandbox2.System" />
<Reference Include="System.Collections" />
<Reference Include="System.Drawing.Common" />
<Reference Include="System.Drawing.Primitives" />
<Reference Include="System.Linq" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Runtime" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Thread" />
</ItemGroup>
<ItemGroup>
<Compile Include="Images\MapperDrawingImages.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Workflow\Drawing\Images\Test.png" />
<EmbeddedResource Include="Workflow\Drawing\Images\Export.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>