Skip to content

Multithreaded inline task factories should work with relative paths to code files #12680

@JanProvaznik

Description

@JanProvaznik

Issue Description

when building MSBuild in -mt mode there is this inline task definition in MSBuild.csproj

  <UsingTask TaskName="ValidateMSBuildPackageDependencyVersions" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
    <Task>
      <Code Source="ValidateMSBuildPackageDependencyVersions.cs" Language="cs" />
    </Task>
  </UsingTask>

  <Target Name="ValidateMSBuildPackageDependencyVersions" BeforeTargets="AfterBuild" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
    <ValidateMSBuildPackageDependencyVersions AppConfig="@(AppConfigWithTargetPath)" AssemblyPath="$(OutputPath)" />
  </Target>

it does not work because the taskfactory resolves the Code file ValidateMSBuildPackageDependencyVersions.cs relatively to -mt process instead of relatively to the project file which defines it.

Steps to Reproduce

build with -mt mode in MSBuild AR-May@16b9c4d

Expected Behavior

it compiles the file resolved relatively to the project file where it's used

Actual Behavior

it resolves the file with cwd of multithreaded process, which is different than the file path

crash in the taskfactory initialization when it does not find the file

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

Labels

Area: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions