我为互操作库创建了一个 nuget 包。使用此包时,Nuget 会自动将“Embed Interop Types”设置为“True”。
但是,在我的项目中,这应该是“False”。
Nuget 中有没有办法指定不应嵌入互操作类型?
我为互操作库创建了一个 nuget 包。使用此包时,Nuget 会自动将“Embed Interop Types”设置为“True”。
但是,在我的项目中,这应该是“False”。
Nuget 中有没有办法指定不应嵌入互操作类型?
我知道这是一个很老的问题,但如果有人面临这个问题,请按照以下步骤操作:
在创建 NuGet 包时,添加一个工具文件夹并添加一个名为:install.ps1 的文件
在下面编写定义项目要求的 PowerShell 命令,在我的情况下,我必须为 SapROTWr 库添加 EmbedInteropTypes: false 。
param($installPath, $toolsPath, $package, $project)
$project.Object.References | Where-Object { $_.Name -eq "Interop.SapROTWr" } | ForEach-Object { $_.EmbedInteropTypes = $false }
现在将该包添加到您的项目并检查属性。