Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppressing warnings through project properties UI adds tfm condition in csproj file for multi targeting project #2804

Open
mishra14 opened this issue Sep 7, 2017 · 12 comments
Labels
Feature-Configurations Handling of configurations and configuration dimensions ("Debug", "Release", "AnyCPU", "net45", etc) Triage-Approved Reviewed and prioritized
Milestone

Comments

@mishra14
Copy link

mishra14 commented Sep 7, 2017

Repro steps:

  1. Create a new NetCore 2.0 Console App
  2. Multi-target to netcoreapp2.0;net461:
    <TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
  3. Add a NuGet reference to a net 461 compat package like RestSharp
  4. Build -> Show 2 warnings which seems to be another bug: Duplicate NU1701 warnings when multi-targetting to netcoreapp2.0 and net461 sdk#1474
  5. Suppress warning NU1701 from Project->Properties->Build->Suppress Warnings
  6. Edit the csproj file -
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.0|AnyCPU'">
    <NoWarn>1701;1702;1705;NU1701</NoWarn>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="RestSharp" Version="105.2.3" />
  </ItemGroup>

</Project>

The issue here is that the user did not select netcoreapp2.0 while suppressing the warning but the csproj has netcoreapp2.0 in the condition.

Other Info:

if you try the same steps in a project that does not multi-target then the condition is fine -

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <NoWarn>1701;1702;1705;NU1701</NoWarn>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="RestSharp" Version="105.2.3" />
  </ItemGroup>

</Project>

VS Version: 15.4.0 Preview 2 | d15rel/16828.0

cc: @natidea @emgarten

@natidea natidea added the Bug label Sep 9, 2017
@davkean davkean added this to the 15.6 milestone Sep 12, 2017
@davkean davkean added Feature Request Feature-Configurations Handling of configurations and configuration dimensions ("Debug", "Release", "AnyCPU", "net45", etc) and removed Bug labels Sep 12, 2017
@davkean
Copy link
Member

davkean commented Sep 12, 2017

We need to design how this is going to work - whether we add a TFM switcher these pages, or we just make sure we don't persist it when we write the condition out.

@anangaur
Copy link

IMO, the ideal solution would be the first one that means implementing the TFM switcher with the default to all/any TFM. This should be followed by any NuGet work required.
@emgarten, @mishra14 is there any follow up work required on NuGet side with approach?

I also see this is marked for 15.6. Can this be considered for 15.5? I am okay with either approach - whichever is faster.

@davkean
Copy link
Member

davkean commented Sep 12, 2017

We're not going to be able to fit this in for 15.5. Does NuGet respect suppressing warnings per TFM?

@anangaur
Copy link

anangaur commented Sep 12, 2017

I am not positive. @mishra14 can confirm. If not, how difficult is it to remove TFM filter for NuGet warning suppression (2nd option)? For 15.5?

@davkean
Copy link
Member

davkean commented Sep 12, 2017

It needs investigation - we don't own that code. It lives in CPS and we'll need to add an extension point to override the behavior,

@mishra14
Copy link
Author

NuGet currently considers the project wide warning properties to be framework independent. This can be changed if needed. But we need to consider if having no warn or warn as error per framework, make sense from a user point of view.

It would be great to have the framework condition removed as the first step!

@anangaur
Copy link

anangaur commented Nov 9, 2017

@davkean, Is this on track for 15.6?

@davkean
Copy link
Member

davkean commented Nov 9, 2017

No, given current priorities this is not on track for 15.6. @Pilchie When are we moving bugs to the "holding" pen that Matt was talking about?

@Pilchie
Copy link
Member

Pilchie commented Nov 10, 2017

Hopefully next week I'll get our 15.6 bugs sorted out.

@Pilchie Pilchie modified the milestones: 15.6, Unknown Dec 22, 2017
@Pilchie
Copy link
Member

Pilchie commented Dec 22, 2017

sigh A bit longer than a week...

@kant2002
Copy link

Any idea then some progress could happens ?

@clairernovotny
Copy link

Bump? This is blocking the ability to suppress warnings per specific TFM in multi-targeting projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Configurations Handling of configurations and configuration dimensions ("Debug", "Release", "AnyCPU", "net45", etc) Triage-Approved Reviewed and prioritized
Projects
None yet
Development

No branches or pull requests

10 participants