Reputation: 5697
I am trying to add metadata reference to my VB.NET project via roslyn using the following syntax:
project = project.AddMetadataReference(
MetadataReference.CreateFromFile(
package.FullName,
MetadataReferenceProperties.Assembly));
However, I need to set "Copy local" to true
for this assembly, how to do that? Seems like for assembly reference I only have WithEmbedInteropTypes
and WithAliases
available, how to set the rest of properties of a particular reference...?
Upvotes: 0
Views: 196
Reputation: 239636
I suspect that "copy local" is an MSBuild feature rather than a compiler feature. If you look at the csc
command line:
- INPUT FILES -
/recurse:<wildcard> Include all files in the current directory and
subdirectories according to the wildcard
specifications
/reference:<alias>=<file> Reference metadata from the specified assembly
file using the given alias (Short form: /r)
/reference:<file list> Reference metadata from the specified assembly
files (Short form: /r)
/addmodule:<file list> Link the specified modules into this assembly
/link:<file list> Embed metadata from the specified interop
assembly files (Short form: /l)
/analyzer:<file list> Run the analyzers from this assembly
(Short form: /a)
/additionalfile:<file list> Additional files that don't directly affect code
generation but may be used by analyzers for produ
cing
errors or warnings.
You can do /reference:<alias>=<file>
to get an alias, or /link:<file list>
to embed interop metadata, but there's no option here to "copy local".
You'll have to perform the copy yourself.
Upvotes: 2