I've got an old-style Settings
class in my project, but I'm trying to convert to netstandard2.0
and I'd like to drop that option while being backwards-compatible and including it on net45
builds.
I've figured out how to exclude the constructor where I'm using it, but I also have to remove it from the build using the .csproj
.
My .cs
:
public class Client
{
#if !NETSTANDARD2_0
public Client(Settings settings) { this.url = settings.Url }
#endif
}
My .csproj
:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\Settings.Designer.cs" Condition="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
</Project>