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

Make GenerateResource look up resgen.exe in 10.0 SDK #6336

Merged
merged 3 commits into from
Apr 21, 2021

Conversation

KirillOsenkov
Copy link
Member

GenerateResource tests were failing when only VS 2019 and 10.0 Windows SDK is installed. I suspect the task itself would also fail if run with ExecuteAsTool.

The problem is that we started look up with .NET 4.6.1 and lower. Start lookup with .NET 4.8 instead and fallback down the chain. This should still find all earlier SDKs too.

Introduce latest versions of Visual Studio too.

Fixes #6266

GenerateResource tests were failing when only VS 2019 and 10.0 Windows SDK is installed. I suspect the task itself would also fail if run with ExecuteAsTool.

The problem is that we started look up with .NET 4.6.1 and lower. Start lookup with .NET 4.8 instead and fallback down the chain. This should still find all earlier SDKs too.

Introduce latest versions of Visual Studio too.
@@ -109,7 +109,7 @@ public enum TargetDotNetFrameworkVersion
/// breaking change. Use 'Latest' if possible, but note the
/// compatibility implications.
/// </summary>
VersionLatest = Version462,
VersionLatest = Version48,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good except this. I'm not sure it should change in a minor update for compatibility reasons. But I'm only saying that as the author of that comment that says not to, not that I remember why not :(.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC it's because enum values get baked into calling assemblies and we wanted it to be possible to use VersionLatest and compile against the latest MSBuild while still running on an earlier patch. Especially given AzDO/GitHub silent VS version updates that still seems like a good conservative policy.

@KirillOsenkov KirillOsenkov added the WIP Work in Progress Pull Request--do not merge yet. label Apr 13, 2021
@KirillOsenkov KirillOsenkov self-assigned this Apr 13, 2021
Version47 = 11,
Version471 = 12,
Version472 = 13,
Version48 = 14,
VersionLatest = 14,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this is also something that shouldn't change mid-major-version.

// VS16
{ (dotNetFrameworkVersion451, visualStudioVersion160), (dotNetFrameworkVersion45, visualStudioVersion160) },
{ (dotNetFrameworkVersion452, visualStudioVersion160), (dotNetFrameworkVersion451, visualStudioVersion160) },
{ (dotNetFrameworkVersion46, visualStudioVersion160), (dotNetFrameworkVersion451, visualStudioVersion160) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches above. But do we know why it's not falling back to 452?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't :)

@@ -109,7 +109,7 @@ public enum TargetDotNetFrameworkVersion
/// breaking change. Use 'Latest' if possible, but note the
/// compatibility implications.
/// </summary>
VersionLatest = Version462,
VersionLatest = Version48,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC it's because enum values get baked into calling assemblies and we wanted it to be possible to use VersionLatest and compile against the latest MSBuild while still running on an earlier patch. Especially given AzDO/GitHub silent VS version updates that still seems like a good conservative policy.

@@ -1065,13 +1065,14 @@ private bool ComputePathToResGen()

if (String.IsNullOrEmpty(_sdkToolsPath))
{
_resgenPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("resgen.exe", TargetDotNetFrameworkVersion.Version35);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being specifically 3.5 makes me a bit nervous. Was it just never changed and usually overridden from project logic, so we never noticed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out we need to leave Version35 here. I've added a comment explaining what is going on.

@KirillOsenkov KirillOsenkov removed the WIP Work in Progress Pull Request--do not merge yet. label Apr 19, 2021
This actually fixes the unit-tests on a machine with only SDK 10.0 installed.
@KirillOsenkov
Copy link
Member Author

Turns out, this commit alone is what fixes the unit-tests for me:
1473d3d

Technically we don't need the first two commits but if I've done the work anyway, I suppose let's keep them.

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Apr 19, 2021
Version160,

/// <summary>
/// Visual Studio "Dev17"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Visual Studio "Dev17"
/// Visual Studio 2022 "Dev17"

nit 😉

@benvillalobos benvillalobos merged commit b7a88ab into main Apr 21, 2021
@benvillalobos benvillalobos deleted the dev/kirillo/generateResource branch April 21, 2021 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GenerateResource tests fail on Windows with only VS 2019 installed
5 participants