3

I am trying to link the file name.ext to assembly.dll using the AL (Assembly Linker) to mimic what can be done in C++ using the /ASSEMBLYLINKRESOURCE option.

The syntax I am using is the following:

al.exe assembly.dll /link:name.ext

and I get the following error:

ALINK: error AL1017: No target filename was specified

I also tried:

al.exe assembly.dll /out:outAssembly.dll /link:name.ext

getting the following error:

ALINK: warning AL1020: Ignoring included assembly 'assembly.dll'

ALINK: error AL1019: Metadata failure while creating assembly -- The system cannot find the file specified.

What I am doing wrong? What is the correct syntax to obtain the resource link?

Thanks.

abenci
  • 8,422
  • 19
  • 69
  • 134
  • The assembly linker requires .netmodule files as input, it can't use a dll. The equivalent C# compiler option is /linkresource. Not supported by the IDE. Hacking msbuild is proposed in [this post](http://stackoverflow.com/a/5854230/17034). – Hans Passant Oct 14 '14 at 13:32

1 Answers1

0

The Assembly Linker generates a file that has an assembly manifest from one or more files that are either modules or resource files. A module is an intermediate language (IL) file that does not have an assembly manifest.

assembly.dll can not be the source of Assembly Linker because it already is an assembly with manifest. So you get this

ALINK: warning AL1020: Ignoring included assembly 'assembly.dll'

kennyzx
  • 12,845
  • 6
  • 39
  • 83
  • I think I cannot use `ILMerge` because the file I am trying to link is not a .NET assembly, it's a generic file I simply need to be copied to output folder when using original `assembly.dll`... – abenci Oct 14 '14 at 13:31
  • you are right, i just read its documentation and find it could't do that. – kennyzx Oct 14 '14 at 13:34
  • then why not make a Setup project to deploy the file? AL is for embedded resources. – kennyzx Oct 14 '14 at 13:38
  • In C++ is possible and it looked like the same thing could be done by AssemblyLinker. Deploy the file is not an option for us. – abenci Oct 14 '14 at 14:18