我正在尝试使用以下语法通过roslyn向我的VB.NET项目添加元数据引用:
project = project.AddMetadataReference(
MetadataReference.CreateFromFile(
package.FullName,
MetadataReferenceProperties.Assembly));
但是,我需要设置"复制本地"到true
这个集会,怎么做?看起来像汇编参考我只有WithEmbedInteropTypes
和WithAliases
可用,如何设置特定参考的其余属性...?
答案 0 :(得分:2)
我怀疑“copy local”是MSBuild功能而不是编译器功能。如果查看csc
命令行:
- 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.
您可以/reference:<alias>=<file>
获取别名,或/link:<file list>
嵌入互操作元数据,但此处没有“复制本地”选项。
您必须自己执行复制。