Skip to content

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

Merged
benvillalobos merged 3 commits intomainfrom
dev/kirillo/generateResource
Apr 21, 2021
Merged

Make GenerateResource look up resgen.exe in 10.0 SDK#6336
benvillalobos merged 3 commits intomainfrom
dev/kirillo/generateResource

Conversation

@KirillOsenkov
Copy link
Copy Markdown
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.
Comment thread src/Utilities/ToolLocationHelper.cs Outdated
/// compatibility implications.
/// </summary>
VersionLatest = Version462,
VersionLatest = Version48,
Copy link
Copy Markdown
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
Copy Markdown
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 self-assigned this Apr 13, 2021
Version471 = 12,
Version472 = 13,
Version48 = 14,
VersionLatest = 14,
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 :)

Comment thread src/Utilities/ToolLocationHelper.cs Outdated
/// compatibility implications.
/// </summary>
VersionLatest = Version462,
VersionLatest = Version48,
Copy link
Copy Markdown
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.


if (String.IsNullOrEmpty(_sdkToolsPath))
{
_resgenPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("resgen.exe", TargetDotNetFrameworkVersion.Version35);
Copy link
Copy Markdown
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
Copy Markdown
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 label Apr 19, 2021
This actually fixes the unit-tests on a machine with only SDK 10.0 installed.
@KirillOsenkov
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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