Skip to content

Condition in Reference from #r directive #50009

@dave-yotta

Description

@dave-yotta

Sometimes we want to conditionally reference dlls:

<Reference Include="NetVips.Native.linux-x64.dll" Version="8.9.1" Condition="$([MSBuild]::IsOsPlatform('Linux'))" />
<Reference Include="NetVips.Native.osx-x64.dll" Version="8.9.1" Condition="$([MSBuild]::IsOsPlatform('OSX'))" />
<Reference Include="NetVips.Native.win-x64.dll" Version="8.9.1" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />

e.g. https://stackoverflow.com/a/60401988/13331441 although on PackageReference, which is not supported in ScriptCompilations directly but its available in https://github.com/filipw/dotnet-script (this is an extension to the roslyn CSharpScript).

So we should be able to write something like #r "NetVips.Native.win", Windows, or someone more general and correct :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions