I have a UsingTask in my project, .Net 6. I have a small script to set the AssemblyVersion, using CodeTaskFactory. See code below. However, I cannot use or execute CodeTaskFactory on the build server using MS Build.
It gives these errors:
Error MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild Error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\dotnet\sdk\6.0.101\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property I looked at some other options, which all failed as they lacked one or another thing. So finally I ask here, what are my options to run a UsingTask with an output on the MS Build server?
My code
<UsingTask TaskName="mytask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> <ParameterGroup> <AssemblyVersion ParameterType="System.String" Output="true" /> </ParameterGroup> <Task> <Code Type="Fragment" Language="cs"> <![CDATA[ Log.LogMessage(MessageImportance.High, "we are here"); AssemblyVersion = "1.2.3.4"; ]]> </Code> </Task> </UsingTask>