I have a new csproj format project that is using <TargetFramework.net472</TargetFramework>
(targeting full .NET Framework), which adds default set of immutable assembly references to the project (as shown on the screenshot).
For example, System.Drawing
is locked and can not be removed.
Yes, I know, if I don't use any classes from System.Drawing
, it will not be actually referenced.
But still, is there any way to remove/ignore/hide it?
I've already tried alias
trick to hide it:
<Reference Update="System.Drawing">
<Aliases>excluded</Aliases>
<Private>false</Private>
</Reference>
Did not work.
I have nothing against System.Drawing
per se — but, what if I have another assembly which exports types with exact same namespaces and names — how to "shadow" existing reference?
Update: csproj looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
</Project>
Just in case anybody is still searching for an answer: set the DisableImplicitFrameworkReferences property to true, then add references to the assemblies that are actually needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.