Wiki
Version 2 (modified by Charles, 6 years ago)

--

Metadata file could not be found

When you get the following compilation error:

error: Metadata file "System.Xml.Linq.dll" could not be found

This can be a mismatch between .NET versions, such as the version Cobra is running on vs. the version the DLL in question was written against. The current solution is to explicitly point to the appropriate back-end C# compiler. Suppose you are accessing a .NET 3.5 DLL, the solution might then be one of these:

cobra -c -d -native-compiler:C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe  foo.cobra
cobra -c -d -native-compiler:C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe  foo.cobra

On the Mono platform, you can set environment variables to provide more information on assembly resolution. For example, at a bash prompt:

$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm cobra -ref:Foo.dll bar.cobra
# or
$ export MONO_LOG_LEVEL=debug
$ export MONO_LOG_MASK=asm
$ cobra -ref:Foo.dll bar.cobra

Cannot locate assembly reference "Foo.dll'

When you get the following compilation error:

Cannot locate assembly reference "Foo.dll"

This can be that the library "Foo.dll" does exist, but is referencing another library that it needs. This error report needs improving. In the meantime, you can get additional information by passing a flag to the Cobra compiler:

cobra -verbosity-ref:1 ...