Home ILRepack doesn't work in multi-project solution with libraries in cascade
Reply: 0

ILRepack doesn't work in multi-project solution with libraries in cascade

Z3NTH10N
1#
Z3NTH10N Published in 2017-11-14 17:25:18Z

I'm trying to make a project where is needed a reference that has merged libraries into it. There isn't problem until we try to embed it into a multi-project solution. As you can see:

We have 3 solutions: Lerp2Web, LiteLerped-WF-API and HugeLauncher (that has 3 projects)

In the first solution:

There we have HtmlAgilityPack and JSON.NET that works perfectly.

In the next solution we have:

A reference to the last assembly I showed.

There we can see that everything works perfectly:

As you can see, the namespace is from the second solution. And all the using are active and none of them has red marks.

This are the namespaces from the second assembly:

This is the first project of the third solution:

As you can see in the image below, we have imported the LiteLerped assembly, and you will see this is working:

And there you can see the three projects I mean:

There you can see how I installed ILRepack (& MSBuild.Task):

I builded the project:

And this two files are generated:

(Watch the path of the DLL and PDB file)

See that I have embed this DLLs into my problematic project.

(You can see what I'm talking about, the path is correct)

And I have tried this two ways:

And well... As you can see something weird is happening here:

Lots of 1061 errors appear.

Well, I have to tell the last thing, and is that I have to modify the .targets file from the ILRepack.Lib.MSBuild.Tasks:

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask AssemblyFile="$(MSBuildThisFileDirectory)ILRepack.Lib.MSBuild.Task.dll" TaskName="ILRepack" />
    <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">

    <ItemGroup>
        <!--- <InputAssemblies Include="$(OutputPath)\$(AssemblyName).exe" /> -->
        <InputAssemblies Include="$(OutputPath)\*.dll" />
    </ItemGroup>

    <ILRepack
        Parallel="true"
        DebugInfo="true"
        AllowDuplicateResources="false"
        InputAssemblies="@(InputAssemblies)"
        TargetKind="SameAsPrimaryAssembly"
        OutputFile="$(OutputPath)\$(AssemblyName).dll" <!--- ===> This extensions was .exe -->
    />
</Target>
<Target 
    AfterTargets="AfterBuild"
    Name="CleanReferenceCopyLocalPaths"
    Condition="'$(Configuration)' == 'Release'" >
    <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
    <ItemGroup>
        <Directories Include="$([System.IO.Directory]::GetDirectories('$(OutDir)%(DestinationSubDirectory)', '*', System.IO.SearchOption.AllDirectories))" />
        <Directories>
            <Files>$([System.IO.Directory]::GetFiles("%(Directories.Identity)", "*", System.IO.SearchOption.AllDirectories).get_Length())</Files>
        </Directories>
    </ItemGroup>        
    <RemoveDir Directories="@(Directories)" Condition="%(Files)=='0'" />
</Target>
</Project>

I have commented what was by default... My problem here is that I don't know how to modify this, because, I need that the first and second project from my solutions output a DLL file (because those projects are library ones), but the third project is a Winforms project and I need to output a exe file, so Idk what I have to write.

Thanks!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295472 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO