Skip to content

Not working with Desktop .NET Framework 4.8 in VS 2020 #71

@slprogrp

Description

@slprogrp

Hi there,

I have created a simple project that has a winforms app and two class libs all using .NET 4.8.
I have added ILRepack.Lib.MSBuild.Task to the winforms probject and added a basic target file and props file.
When I build in both debug and release mode the merge is not done.
What am I doing wrong?
I have attached a zip of the project.

Regards,

Scotty

namespace ClassLib1
{
    public static class Main
    {
        public static string Test1()
        {
            return "Test1";
        }
    }
}
namespace ClassLib2
{
    public static class Main
    {
		public static string Test2()
		{
			return "Test2";
		}
	}
}

winforms app:

internal static class Program
{
	/// <summary>
	/// The main entry point for the application.
	/// </summary>
	[STAThread]
	static void Main()
	{
		Console.WriteLine(ClassLib1.Main.Test1());
		Console.WriteLine(ClassLib2.Main.Test2());

		Application.EnableVisualStyles();
		Application.SetCompatibleTextRenderingDefault(false);
		Application.Run(new Form1());
	}
}

targets:

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<!-- ILRepack -->
	<Target Name="ILRepack" AfterTargets="Build">
		<ItemGroup>
			<InputAssemblies Include="$(OutputPath)$(TargetName)$(TargetExt)"/>
			<InputAssemblies Include="$(OutputPath)*.dll" Exclude="$(OutputPath)$(TargetName)$(TargetExt)"/>
		</ItemGroup>

		<ILRepack
			Parallel="true"
			DebugInfo="true"
			AllowDuplicateResources="false"
			InputAssemblies="@(InputAssemblies)"
			TargetKind="SameAsPrimaryAssembly"
			KeyFile="$(KeyFile)"
			OutputFile="$(OutputPath)$(TargetName)$(TargetExt)"
			LogFile="$(OutputPath)ILRepack.log"
		/>
	</Target>
	<!-- /ILRepack -->
</Project>

props:

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<ClearOutputDirectory>True</ClearOutputDirectory>
	</PropertyGroup>
</Project>

TestILRepack.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions