ravibpatel / ILRepack.Lib.MSBuild.Task

MSBuild task for ILRepack which is an open-source alternative to ILMerge.
Other
107 stars 30 forks source link

Failed to resolve assembly Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' #34

Open FrankSzendzielarz opened 2 years ago

FrankSzendzielarz commented 2 years ago

ILRepack task always fails with the above error. This is even if the target is in an external file, or in the csproj. Even if the assembly list to merge is just a single assembly, the above error occurs.

Cannot get this to work.

JustArion commented 1 year ago

I've been getting the same issue.

JustArion commented 1 year ago

A workaround that fixed the issue for me was from the duplicate #26, from this comment .

chocataw commented 1 year ago

The workaround I came across for this same issue is below: I had this issue and I believe the fix was adding an inputassemblies reference in ILRepack.targets. Please note the expandable ReferencePathWithRefAssemblies inclusion. Just add the file name and exclude the .dll (file type). This fix was taken from https://www.meziantou.net/merging-assemblies-using-ilrepack.htm

  <ItemGroup>
      <InputAssemblies Include="$(TargetPath)"/>
      <InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Newtonsoft.Json'" />
      <InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Microsoft.Xrm.Sdk.Workflow'" />
      <InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Microsoft.Xrm.Sdk'" />
      <InputAssemblies Include="@(ReferencePathWithRefAssemblies)" Condition="'%(filename)' == 'Microsoft.Crm.Sdk.Proxy'" />
      <InputAssemblies Include="$(OutputPath)\MyAssembly.dll" />
    </ItemGroup>