Multitarget and dynamic CS0656


#1

I have a class library like this:

  <PropertyGroup>
    <TargetFrameworks>net461;netstandard1.6</TargetFrameworks>
    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
    <Version>1.0.0</Version>
    <Company>company LLC</Company>
    <Description>company universal common library for dotnet</Description>
    <Copyright>company © 2017</Copyright>
    <PackageProjectUrl>https://github.com/blah</PackageProjectUrl>
    <RepositoryUrl>https://github.com/blah</RepositoryUrl>
    <RepositoryType>Git</RepositoryType>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <FileVersion>1.0.0.0</FileVersion>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
    <PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
    <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
    <PackageReference Include="System.ComponentModel" Version="4.3.0" />
  </ItemGroup>
</Project>

In the library I’m using dynamic something intensively having IEnumerable, dynamic method parameters, dynamic properties, methods returning dynamics, ConcurrentBag, ConcurrentDictionary<dynamic, MapResult> (yes is a map-reduce implemented in C#).
As you can imagine, everything work as expected in full-fw 4.6.1.
When I try to compile the new library with the target above the result is a bunch of:
Error CS0656 Missing compiler required member ‘Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create’ company(netstandard1.6)

What I’m doing wrong ?

Thanks.


#2

Apparently the problem, is inside the multitarget…but in the Full-FW “zone” even if the exception seems to refer to the netstandard.

This is the solution:

  <PropertyGroup>
    <TargetFrameworks>net461;netstandard1.6</TargetFrameworks>
    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
    <Version>1.0.0</Version>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <FileVersion>1.0.0.0</FileVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
    <DefineConstants>NETSTANDARD</DefineConstants>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetFramework)'=='net461'">
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
    <PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
    <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
    <PackageReference Include="System.ComponentModel" Version="4.3.0" />
  </ItemGroup>
</Project>

.NET Foundation Website | Blog | Projects | Code of Conduct