0

Issue Description

I have a project without any files - Sample.csproj. The ILRepack step fails with the error message shown in the issue title.

Steps to Reproduce

Sample.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard20</TargetFrameworks>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  
    <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.2" />
    <PackageReference Include="Autofac" Version="4.6.2" />
    <PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.18" />
  </ItemGroup>

  <Target Name="ILRepacker" AfterTargets="Build">
    <ItemGroup>
      <InputAssemblies Include="$(TargetPath)" />
      <InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Autofac'" />
    </ItemGroup>
    <ILRepack InputAssemblies="@(InputAssemblies)" OutputFile="$(TargetPath)" LibraryPath="$(OutputPath)" />
  </Target>

</Project>

I am building this project in Visual Studio and get the following error:

    Target ILRepacker:
      Task "ILRepack"
        Added assembly 'D:\Sample\bin\Release\netstandard20\Sample.dll'
        Added assembly 'C:\Users\aleksandrs.jakovlevs\.nuget\packages\autofac\4.6.2\lib\netstandard1.1\Autofac.dll'
        Merging 2 assembies to 'D:\Sample\bin\Release\netstandard20\Sample.dll'
        MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "C:\Users\aleksandrs.jakovlevs\AppData\Local\Temp\MSBuildTempAleksandrs.Jakovlevs\" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.

Versions & Configurations

MSBuild version - 17.5.1.16304 Visual Studio version - Professional 2022 17.5.3

What I have been able to gather

No file appears in the folder mentioned in the error message. If I remove reference to Microsoft.NETCore.Portable.Compatibility or set CopyLocalLockFileAssemblies to false or remove LibraryPath="$(OutputPath)" from ILRepack target, the build succeeds.

0 Answers0