I have a project where I set up the project file as follows:
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
</PropertyGroup>
<!-- .NET Standard 2.0 references, compilation flags and build options -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETCORE;</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
</ItemGroup>
<!-- .NET 4.7.2 references, compilation flags and build options -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net472'">
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472'">
<Content Include="3rd Party\SomeThirdParty.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
</Content>
</ItemGroup>
And am trying to use it in a class like this:
using System;
#if NETFULL
using SomeThirdParty.Namespace;
#endif
using mynamespace
{
public class MyClass
{
}
}
However I get a compile error for the netstandard2.0 build complaining about "type of namespace 'SomeThirdParty.Namespace' could not be found"
My understanding is that only the NETFULL build will even see the using statement and try to compile with this.
Can anyone help here?