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

Dependencies node fails to handle custom target frameworks #2618

Closed
sharwell opened this issue Jul 15, 2017 · 5 comments · Fixed by #9008
Closed

Dependencies node fails to handle custom target frameworks #2618

sharwell opened this issue Jul 15, 2017 · 5 comments · Fixed by #9008
Assignees
Labels
Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references Feature-Multi-Targeting Targeting and building for multiple frameworks. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Milestone

Comments

@sharwell
Copy link
Member

Steps to reproduce

  1. Create a new project
  2. Set the target frameworks to Xyz1.0
  3. Explicitly set the TargetFrameworkIdentifier, TargetFrameworkVersion, and TargetFrameworkProfile properties
  4. Open the project in Visual Studio
<PropertyGroup>
  <TargetFrameworks>Xyz1.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
  <TargetFrameworkIdentifier>.NETCustom</TargetFrameworkIdentifier>
  <TargetFrameworkVersion>v42.42</TargetFrameworkVersion>
  <TargetFrameworkProfile />
</PropertyGroup>

Expected results

Solution Explorer shows a dependencies node based on the explicitly set framework identifier, version, and profile. In the above case, this would be .NETCustom 42.42.

Actual results

Solution Explorer shows Unsupported 0.0.

@srivatsn srivatsn modified the milestones: 15.3, 15.5 Jul 24, 2017
@abpiskunov
Copy link
Contributor

This scenario is kind of limited. If you specify custom TFMX - how does project system/nuget know if TFMX can support a net46 etc? Dependencies logic needs this info in several places to decide if a warning icon should be displayed for project to project references for example...

@sharwell
Copy link
Member Author

sharwell commented Jul 24, 2017

📝 This is related to #1938, though the problem can manifest in other scenarios as well. In my case, I believe I was trying to work around #2617 when I first hit this.

@srivatsn
Copy link
Contributor

srivatsn commented Jul 24, 2017

The project system should just use the full target framework moniker for such comparisons. The simplest thing to do here might be to just show the TF as-is without mapping it to anything. That way if the user has a testingfornetstandard1.0 TF as in my example in #1938 then that value shows up in the tree. That node can have a TargetFrameworkMoniker property (in the property grid) which can show what it maps to by simply evaluating the TargetFrameworkMoniker

@davkean
Copy link
Member

davkean commented Jul 24, 2017

Yes, this should work and how this was designed. In particular:

DO NOT parse or attempt to reason about the values of properties that make up the dimensions for a project configuration; $(Configuration), $(Platform) and $(TargetFramework), and their plural counterparts; $(Configurations), $(Platforms) and $(TargetFrameworks).
These properties are user "aliases" and should only be used for conditions, display and grouping purposes. Instead, the project system should be using their canonical equivalents; $(PlatformTarget) instead of $(Platform), and $(TargetFrameworkMoniker) instead of $(TargetFramework).

@natidea natidea modified the milestones: 15.5, 15.7 Sep 25, 2017
@davkean davkean added Feature-Multi-Targeting Targeting and building for multiple frameworks. and removed Feature - Cross Targeting labels Feb 27, 2018
@Pilchie Pilchie modified the milestones: 15.7, 15.8 Mar 30, 2018
@Pilchie Pilchie added the Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references label Mar 30, 2018
@Pilchie Pilchie modified the milestones: 15.8, 16.0 Jul 3, 2018
@jjmew jjmew modified the milestones: 16.0, 16.X Feb 13, 2019
@jjmew jjmew self-assigned this Sep 19, 2019
@etbyrd etbyrd removed their assignment Nov 11, 2019
@jjmew jjmew assigned drewnoakes and unassigned jjmew Feb 18, 2020
@jjmew jjmew added the Triage-Investigate Reviewed and investigation needed by dev team label Feb 18, 2020
@drewnoakes
Copy link
Member

Another test case for this:

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

  <PropertyGroup>
    <TargetFrameworks>foo1.0;bar2.0</TargetFrameworks>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetFramework)' == 'foo1.0'">
    <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>7.0</TargetFrameworkVersion>
    <TargetFrameworkProfile />
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetFramework)' == 'bar2.0'">
    <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>2.0</TargetFrameworkVersion>
    <TargetFrameworkProfile />
  </PropertyGroup>

</Project>

Screenshot from the dependencies tree rewrite:

image

@ghost ghost added the Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. label May 16, 2023
@drewnoakes drewnoakes removed the Bug label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references Feature-Multi-Targeting Targeting and building for multiple frameworks. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants