Forum

C# merge all dlls i...
 
Notifications
Clear all

C# merge all dlls into one exe file using ILRepack.Lib.MSBuild.Task

1 Posty
1 Users
0 Reactions
1,197 Widok
0
Topic starter

example

1 Answer
0
Topic starter
  1. inside NuGet console, type
      Install-Package ILRepack.Lib.MSBuild.Task
    
  2. inside directory where is *.csproj create ILRepack.targets file
  3. <?xml version="1.0" encoding="utf-8" ?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name="ILRepacker" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
    
        <ItemGroup>
    	<InputAssemblies Include="$(OutputPath)$(TargetName)$(TargetExt)" />
            <InputAssemblies Include="$(OutputPath)MyAnotherDll.dll" />
        </ItemGroup>
    
        <ILRepack
    	  Parallel="true"
          DebugInfo="true"
          AllowDuplicateResources="false"
          InputAssemblies="@(InputAssemblies)"
          TargetKind="SameAsPrimaryAssembly"
          KeyFile="$(KeyFile)"
          OutputFile="$(OutputPath)merged\$(TargetName)$(TargetExt)"
        />
    
        </Target>
    </Project>
  4. this configuration also repair's error
    The process cannot access the file 'bin\Debug\MyAssembly.pdb' because it is being used by another process.
  5. switch project to RELEASE, now run or compile
  6. merged file is inside _PROJECT_\bin\Release\merged

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: