I am using MessagePack to create executables. However, I want to create one big mpc.exe file that includes the dotnet library. That file is created by building the MessagePack.Generator. So I used ILRepack, and it outputs an error message like the one in the title.
I am building a project with the following path
https://github.com/MessagePack-CSharp/MessagePack-CSharp
Following advice from the web, I added the '-nodeReuse:false' option to the build command for the dotnet.yml file in MessagePack.
from : - script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog -v:d" to : - script: dotnet build -t:build,pack --no-restore -c -nodeReuse:false $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog -v:d"
But the build still fails. The project csproj file we're trying to build looks like this
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>mpc</AssemblyName>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ToolCommandName>mpc</ToolCommandName>
<RollForward>Major</RollForward>
<!-- NuGet Info -->
<PackageId>MessagePack.Generator</PackageId>
<Title>MessagePack Code Generator</Title>
<Description>MessagePack standalone code generator.</Description>
<PackageTags>MsgPack;MessagePack;Serialization;Formatter;Serializer;Unity;Xamarin</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ConsoleAppFramework" />
<PackageReference Include="ILRepack" />
<PackageReference Include="ILRepack.MSBuild.Task" />
<PackageReference Include="Microsoft.Build.Locator" />
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MessagePack.GeneratorCore\MessagePack.GeneratorCore.csproj" />
</ItemGroup>
<Target Name="ILRepack" AfterTargets="Build">
<PropertyGroup>
<WorkingDirectory>$(MSBuildThisFileDirectory)bin\$(Configuration)\$(TargetFramework)</WorkingDirectory>
</PropertyGroup>
<ItemGroup>
<InputAssemblies Include="@(ReferencePathWithRefAssemblies)" />
</ItemGroup>
<Message Text="MERGING: @(InputAssemblies->'%(Filename)') into $(OutputAssembly)" Importance="High" />
<ILRepack OutputType="$(OutputType)" MainAssembly="$(OutputPath)\$(AssemblyName).dll" OutputAssembly="$(AssemblyName).exe" InputAssemblies="@(InputAssemblies)" WorkingDirectory="$(OutputPath)" Parallel="false" Verbose="true" />
</Target>
</Project>
What can I do now?
I tried rebooting, and I tried running a clean build. And I can't find the diagnostic information named MSBuild_*.failure.txt.