Skip to content

Commit

Permalink
Adding support for 4.5.2 target framework
Browse files Browse the repository at this point in the history
Closes #601
  • Loading branch information
AndyGerlicher committed May 4, 2016
1 parent e4a55ee commit fd97b76
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Shared/FrameworkLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ internal static class FrameworkLocationHelper
internal static readonly Version dotNetFrameworkVersion40 = new Version(4, 0);
internal static readonly Version dotNetFrameworkVersion45 = new Version(4, 5);
internal static readonly Version dotNetFrameworkVersion451 = new Version(4, 5, 1);
internal static readonly Version dotNetFrameworkVersion452 = new Version(4, 5, 2);
internal static readonly Version dotNetFrameworkVersion46 = new Version(4, 6);
internal static readonly Version dotNetFrameworkVersion461 = new Version(4, 6, 1);

Expand Down Expand Up @@ -193,6 +194,9 @@ internal static class FrameworkLocationHelper
// v4.5.1
CreateDotNetFrameworkSpecForV4(dotNetFrameworkVersion451, visualStudioVersion120),

// v4.5.2
CreateDotNetFrameworkSpecForV4(dotNetFrameworkVersion452, visualStudioVersion120),

// v4.6
CreateDotNetFrameworkSpecForV4(dotNetFrameworkVersion46, visualStudioVersion140),

Expand Down Expand Up @@ -236,6 +240,7 @@ internal static class FrameworkLocationHelper
dotNetFrameworkVersion40,
dotNetFrameworkVersion45,
dotNetFrameworkVersion451,
dotNetFrameworkVersion452
}),

// VS14
Expand All @@ -247,6 +252,7 @@ internal static class FrameworkLocationHelper
dotNetFrameworkVersion40,
dotNetFrameworkVersion45,
dotNetFrameworkVersion451,
dotNetFrameworkVersion452,
dotNetFrameworkVersion46,
dotNetFrameworkVersion461
}),
Expand All @@ -265,9 +271,11 @@ internal static class FrameworkLocationHelper
{
// VS12
{ Tuple.Create(dotNetFrameworkVersion451, visualStudioVersion120), Tuple.Create(dotNetFrameworkVersion45, visualStudioVersion120) },
{ Tuple.Create(dotNetFrameworkVersion452, visualStudioVersion120), Tuple.Create(dotNetFrameworkVersion451, visualStudioVersion120) },

// VS14
{ Tuple.Create(dotNetFrameworkVersion451, visualStudioVersion140), Tuple.Create(dotNetFrameworkVersion45, visualStudioVersion140) },
{ Tuple.Create(dotNetFrameworkVersion452, visualStudioVersion140), Tuple.Create(dotNetFrameworkVersion451, visualStudioVersion140) },
{ Tuple.Create(dotNetFrameworkVersion46, visualStudioVersion140), Tuple.Create(dotNetFrameworkVersion451, visualStudioVersion140) },
{ Tuple.Create(dotNetFrameworkVersion461, visualStudioVersion140), Tuple.Create(dotNetFrameworkVersion46, visualStudioVersion140) },
};
Expand Down
9 changes: 9 additions & 0 deletions src/Utilities/ToolLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public enum TargetDotNetFrameworkVersion
/// </summary>
Version461 = 8,

/// <summary>
/// version 4.5.2. Enum is out of order because it was shipped out of band from a Visual Studio update
/// without a corresponding SDK release.
/// </summary>
Version452 = 9,

// keep this up to date, this should always point to the last entry
/// <summary>
/// the latest version available at the time of release
Expand Down Expand Up @@ -1766,6 +1772,9 @@ private static Version TargetDotNetFrameworkVersionToSystemVersion(TargetDotNetF
case TargetDotNetFrameworkVersion.Version451:
return FrameworkLocationHelper.dotNetFrameworkVersion451;

case TargetDotNetFrameworkVersion.Version452:
return FrameworkLocationHelper.dotNetFrameworkVersion452;

case TargetDotNetFrameworkVersion.Version46:
return FrameworkLocationHelper.dotNetFrameworkVersion46;

Expand Down
6 changes: 6 additions & 0 deletions src/Utilities/UnitTests/ToolLocationHelper_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,12 @@ public void TestGetDotNetFrameworkSdkRootRegistryKey()
Assert.Equal(ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version451, VisualStudioVersion.Version120), fullDotNetFrameworkSdkRegistryPathForV4ToolsOnManagedToolsSDK81A);
Assert.Equal(ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version451, VisualStudioVersion.Version140), fullDotNetFrameworkSdkRegistryPathForV4ToolsOnManagedToolsSDK46);

// v4.5.2
ObjectModelHelpers.AssertThrows(typeof(ArgumentException), delegate { ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version451, VisualStudioVersion.Version100); });
ObjectModelHelpers.AssertThrows(typeof(ArgumentException), delegate { ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version451, VisualStudioVersion.Version110); });
Assert.Equal(ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version452, VisualStudioVersion.Version120), fullDotNetFrameworkSdkRegistryPathForV4ToolsOnManagedToolsSDK81A);
Assert.Equal(ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version452, VisualStudioVersion.Version140), fullDotNetFrameworkSdkRegistryPathForV4ToolsOnManagedToolsSDK46);

// v4.6
ObjectModelHelpers.AssertThrows(typeof(ArgumentException), delegate { ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version46, VisualStudioVersion.Version100); });
ObjectModelHelpers.AssertThrows(typeof(ArgumentException), delegate { ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version46, VisualStudioVersion.Version110); });
Expand Down
18 changes: 18 additions & 0 deletions src/XMakeTasks/GetFrameworkPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class GetFrameworkPath : TaskExtension
private static string s_version40Path;
private static string s_version45Path;
private static string s_version451Path;
private static string s_version452Path;
private static string s_version46Path;
private static string s_version461Path;

Expand Down Expand Up @@ -176,6 +177,23 @@ public string FrameworkVersion451Path
}
}

/// <summary>
/// Path to the v4.5.2 framework, if available
/// </summary>
[Output]
public string FrameworkVersion452Path
{
get
{
if (s_version452Path == null)
{
s_version452Path = ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version452);
}

return s_version452Path;
}
}

/// <summary>
/// Path to the v4.6 framework, if available
/// </summary>
Expand Down

0 comments on commit fd97b76

Please sign in to comment.