.net 如何使用“添加引用”;“复制本地”;真的吗?

.net 如何使用“添加引用”;“复制本地”;真的吗?,.net,vb.net,roslyn,.net,Vb.net,Roslyn,我试图通过roslyn使用以下语法将元数据引用添加到我的VB.NET项目中: project = project.AddMetadataReference( MetadataReference.CreateFromFile( package.FullName, MetadataReferenceProperties.Assembly)); 但是,我需要为此程序集将“Copy local”设置为true,如何操作?似乎对于程序集引用,我只有带嵌入互操作类型

我试图通过roslyn使用以下语法将元数据引用添加到我的VB.NET项目中:

project = project.AddMetadataReference(
    MetadataReference.CreateFromFile(
        package.FullName,
        MetadataReferenceProperties.Assembly));
但是,我需要为此程序集将“Copy local”设置为
true
,如何操作?似乎对于程序集引用,我只有
带嵌入互操作类型的
带别名的
可用,如何设置特定引用的其余属性…?

我怀疑“复制本地”是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.
-输入文件-
/递归:包括当前目录中的所有文件,并
根据通配符的子目录
规格
/引用:=来自指定程序集的引用元数据
使用给定别名的文件(缩写:/r)
/引用:引用指定程序集中的元数据
文件(缩写:/r)
/addmodule:将指定的模块链接到此程序集
/链接:从指定的互操作中嵌入元数据
程序集文件(缩写:/l)
/analyzer:从此程序集中运行分析器
(缩写:/a)
/additionalfile:不直接影响代码的附加文件
但可由分析仪用于生产
冰
错误或警告。
您可以执行
/reference:=
来获取别名,或
/link:
来嵌入互操作元数据,但这里没有“复制本地”选项

您必须自己执行复制。

我怀疑“复制本地”是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.
-输入文件-
/递归:包括当前目录中的所有文件,并
根据通配符的子目录
规格
/引用:=来自指定程序集的引用元数据
使用给定别名的文件(缩写:/r)
/引用:引用指定程序集中的元数据
文件(缩写:/r)
/addmodule:将指定的模块链接到此程序集
/链接:从指定的互操作中嵌入元数据
程序集文件(缩写:/l)
/analyzer:从此程序集中运行分析器
(缩写:/a)
/additionalfile:不直接影响代码的附加文件
但可由分析仪用于生产
冰
错误或警告。
您可以执行
/reference:=
来获取别名,或
/link:
来嵌入互操作元数据,但这里没有“复制本地”选项

你得自己复印