-
Notifications
You must be signed in to change notification settings - Fork 52
Conversation
Codecov Report
@@ Coverage Diff @@
## master #804 +/- ##
==========================================
+ Coverage 11.57% 11.84% +0.26%
==========================================
Files 503 504 +1
Lines 12289 12316 +27
==========================================
+ Hits 1423 1459 +36
+ Misses 10866 10857 -9
Continue to review full report at Codecov.
|
ivannaranjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change regarding the versioning of the SDK vs. the versioning of the runtimes. They do not match 1 to 1, we should encode that in the code somewhere.
| /// </summary> | ||
| public static readonly AspNetVersion AspNet4 = new AspNetVersion("4", false); | ||
|
|
||
| private static readonly Version s_sdkVersion10 = new Version(1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, I recommend separating the major and minor versions in the name, as in s_sdkVersion1_1, I think it will be more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Changing my resharper settings for private static fields to be s_lowerCamelCase_UnderscoresTolerant.
| { | ||
| AspNetCore1Preview | ||
| }; | ||
| return new List<AspNetVersion> {AspNetCore1Preview}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, you could use the => syntax for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| return new List<AspNetVersion> | ||
| Version result; | ||
| List<Version> sdkVersions = VsVersionUtils.ToolsPathProvider.GetNetCoreSdkVersions() | ||
| .Where(version => System.Version.TryParse(version, out result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you parsing the versions twice with this expression? Seems that you are forcing the use of LINQ when a simple foreach loop where you store the versions that can be parsed would do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| /// </summary> | ||
| public static readonly AspNetVersion AspNet4 = new AspNetVersion("4", false); | ||
|
|
||
| private static readonly Version s_sdkVersion10 = new Version(1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the versions of the SDK do not match the versions of the runtime. The current supported SDKs are 1.0.4 and 2.0.0. Where the 1.0.4 SDK supports .NET Core 1.0.5 and 1.1.2. The .NET Core SDK 2.0.0 supports the .NET Core runtime 2.0.0. There's no .NET Core SDK 1.1.x.
Yes it's confusing and silly, but that what it is. You should decouple this concepts here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the built in ASP.NET Core template dialog allows ASP.NET Core 1.0 and 1.1 when any 1.x SDK is installed. Changing my code to match.
| { | ||
| IEnumerable<string> sdkVersions = VsVersionUtils.ToolsPathProvider.GetNetCoreSdkVersions(); | ||
| switch (GoogleCloudExtensionPackage.VsVersion) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird indentation of { and } for the switch statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
| return Directory.EnumerateDirectories(sdkDirectoryPath) | ||
| .Select(Path.GetFileName) | ||
| .Where(sdkVersion => !NugetFallbackFolderName.Equals(sdkVersion)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just !=, .NET has the right semantics for comparing strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
PTAL. |
| return new List<AspNetVersion> | ||
| List<Version> sdkVersions = GetParsedSdkVersions().ToList(); | ||
| var aspNetVersions = new List<AspNetVersion>(); | ||
| if (sdkVersions.Any(version => version >= s_sdkVersion1_0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woudn't this mean that having SDK 2.0 will support .NET Core 1.0 and 1.1? That is not true, see the download archive, the .NET Core SDK 2.0.0 only supports .NET Core 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The built in ASP.NET Core templates allow you to create projects for ASP.NET Core 1.0 and 1.1 with only SDK 2.0 installed.
A computer with only the .NET Core SDK version 2.0 installed can compile and run projects targeting .NET Core 1.0 and 1.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, the .NET Core 2.0.0 SDK only supports .NET Core 2.0 runtime, you cannot create apps that target netcoreapp1.1 with it. Also the .NET Core 2.0 runtime cannot run .NET Core 1.1 (or 1.0) apps, the .NET Core runtime is not backwards compatible that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right about the running part. I tired it on a fresh install, uninstalled SDK 1.1.0, installed SDK 2.0.0. The built in ASP.NET Core 1.0 and 1.1 templates were available and built correctly, but failed when attempting to run.
| AspNetCore1Preview | ||
| }; | ||
| } | ||
| AspNetCore1Preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check for the presence of the preview SDK as well no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do in another way.
I am changing the code to be more consistent for VS2015 and VS2017.
| } | ||
| return Directory.EnumerateDirectories(sdkDirectoryPath) | ||
| .Select(Path.GetFileName) | ||
| .Where(sdkVersion => NugetFallbackFolderName != sdkVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could perform the filtering here, removing those directory names that do not denote versions. I think that the callers should not be the ones performing this filtering since this method is supposed to return valid versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about the Version.TryParse(input, out version) filtering? The problem with that is 1.0.0-preview2 is not a valid Version, even though it is an SDK version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option would be to include a third party SemVer package, and filter on being able to parse that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could special case that particular SDK version (since it is the only one that VS 2015 really supports).
I was also referering to the fact that this method should only return valid SDK versions installed, as it is written right now it leaks the fact that it is listing directories.
…ersion method to match VS2017. Make .NET Core visable based on availability of ASP.NET Core versions.
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
Please look again at the .NET Core 2.0 support issues. |
|
CLAs look good, thanks! |
|
PTAL. |
| /// </summary> | ||
| public static readonly AspNetVersion AspNet4 = new AspNetVersion("4", false); | ||
|
|
||
| private static readonly Version s_sdkVersion1_0 = new Version(1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another wrench thrown your way, the latest SDK is actually 1.1.4 and covers both .NET Core runtime 1.0 and 1.1. I think that you are going to have to create a table to codify the releases here, with what versions of .NET Core they target, etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not accurate, your logic (looking for .NET Core SDK between 1.0.x to 2.0.x) works perfectly.
ivannaranjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I should have read it more detail. You actually have encapsulated the logic quite well.
Fixes #803.
Determine the installed .NET Core Sdk versions and only allows ASP.NET Core templates for those that are supported.