Merijn
Merijn

Reputation: 723

Prevent embedding interop types in nuspec package file

I've created a nuget package for an interop library. When using this package, Nuget automatically sets "Embed Interop Types" to "True".

However, in my project this should be "False".

Is there a way in Nuget to specify that interop types should not be embedded?

Upvotes: 8

Views: 421

Answers (1)

sobby01
sobby01

Reputation: 2154

I know it's quite an old question but if someone faces this then follow the below steps :

While creating a NuGet package, add a tools folder and add a file named: install.ps1

Write below PowerShell commands which define the project requirement, In my case, I had to add EmbedInteropTypes: false for SapROTWr library.

param($installPath, $toolsPath, $package, $project)

$project.Object.References | Where-Object { $_.Name -eq "Interop.SapROTWr" } |  ForEach-Object { $_.EmbedInteropTypes = $false }

Now add that package to your project and checkout the properties.

Upvotes: 2

Related Questions