MSB3474: The task "SGen" is not supported on the .NET Core version of MSBuild.

Problem Statement:

When you get the below error when you are running the .Net 6 code, do follow the steps mentioned in the solution part.

C:\Program Files\dotnet\sdk\6.0.425\Microsoft.Common.CurrentVersion.targets(3772,5): error MSB3474: The task "SGen" is not supported on the .NET Core version of MSBuild. Use the Microsoft XML Serializer Generator package instead. See

https://go.microsoft.com/fwlink/?linkid=858594

for more information. [C:\src\Lib\XmlProcessor_sln\Petro.Lib.XmlProcessor\Petro.Lib.XmlProcessor.cspro

 

Solution: 

  1. Look for <AutoGen> and set that to False <AutoGen>False</AutoGen> in .cspro file.
  2. Add the below parameters in the .cspro file & then build the . Net code

<PropertyGroup>

    <TargetFramework>net6.0</TargetFramework>

    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>

    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>

    <AutoGen>False</AutoGen>

    <AssemblyVersion>1.0.0.0</AssemblyVersion>

    <PlatformTarget>AnyCPU</PlatformTarget>

  </PropertyGroup>

</Project>

 

 

 


No comments:

Post a Comment

Featured Post

Cloud : A Trendsetter Technology