Sdk: Targeting net20 results in broken reference warnings

Created on 18 Dec 2016  路  3Comments  路  Source: dotnet/sdk

_From @jnm2 on December 17, 2016 17:54_

(I'm multitargeting net20 and netstandard1.3 but this happens also when just targeting net20.)

Under Dependencies > Assemblies I have System, System.Core, System.Data, System.Drawing, System.Runtime.Serialization, System.Xml and System.Xml.Linq. Of these I only actually need System, so ordinarily I'd delete the rest. However deleting is impossible since they are defined outside my .csproj.

Not being able to delete doesn't bother me too much, except that I get build warnings for System.Core, System.Runtime.Serialization and System.Xml.Linq due to targeting net20.

If you are going to require mandatory assembly references if one of the targets is .NET Framework, I'd expect you to detect which references make sense to add given the framework version. (Personally I'd be even more happy with no mandatory references and having to list them in the .csproj so I can delete all of them except System.)

_Copied from original issue: dotnet/roslyn-project-system#987_

Bug

Most helpful comment

@dsplaisted https://github.com/dotnet/sdk/pull/379 does not account for assemblies that are not in 2.0.

@jnm2 You can add the following to your project and then control the references yourself:

<PropertyGoup>
  <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

All 3 comments

@dsplaisted https://github.com/dotnet/sdk/pull/379 does not account for assemblies that are not in 2.0.

@jnm2 You can add the following to your project and then control the references yourself:

<PropertyGoup>
  <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

Yes, we should.

Was this page helpful?
0 / 5 - 0 ratings