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

removing the conflicting assembly #11254

Merged
merged 1 commit into from
Jan 13, 2025
Merged

removing the conflicting assembly #11254

merged 1 commit into from
Jan 13, 2025

Conversation

SimaTian
Copy link
Member

Fixes microsoft/azure-pipelines-tasks#20734

Context

This is a hopefully temporary rollback due to the assembly collision in Microsoft.IO.Redist

Changes Made

Removed the conflicting dependency.

Testing

Existing tests.

Notes

We have a proper fix here: microsoft/azure-pipelines-tasks-common-packages#422
However since this change is breaking a lot of people, we're doing this as an interim-patch.

@SimaTian SimaTian force-pushed the AZDO-assembly-collision branch from b6f9f79 to 0b6af78 Compare January 10, 2025 14:27
@SimaTian
Copy link
Member Author

I've worked with @surayya-MS and @JanProvaznik to check if this is enough to remove the assembly conflict. It appears that this should be sufficient. The current main branch silently fails in windows powershell and works with this change when using the test script


	$Architecture = 'x64'
 
	$Path = "D:\bld\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\Microsoft.Build.Utilities.Core.dll"
	$msUtilities = [System.Reflection.Assembly]::LoadFrom($Path)

	[type]$t = $msUtilities.GetType('Microsoft.Build.Utilities.ToolLocationHelper')
	if ($t -ne $null) 
	{
		[System.Reflection.MethodInfo] $mi = $t.GetMethod("GetPathToBuildToolsFile",[type[]]@( [string], [string], $msUtilities.GetType("Microsoft.Build.Utilities.DotNetFrameworkArchitecture") ))

	$param3 = $mi.GetParameters()[2]
		$archValues = [System.Enum]::GetValues($param3. ParameterType)


	[object] $archValue = $null
			if ($Architecture -eq 'x86') {
				$archValue = $archValues.GetValue(1) # DotNetFrameworkArchitecture.Bitness32
			} elseif ($Architecture -eq 'x64') {
				$archValue = $archValues.GetValue(2) # DotNetFrameworkArchitecture.Bitness64
			} else {
				$archValue = $archValues.GetValue(1) # DotNetFrameworkArchitecture.Bitness32
			}
		#Write-Host "archValue = $archValue"

	$msBuildPath = $mi.Invoke($null, @( 'msbuild.exe', '17.0', $archValue ))
		$msBuildPath
	}

I've also started exp insertion recommended by @YuliiaKovalova, unless this PR is urgent-urgent I would prefer to wait with the merge until it finishes.

@SimaTian SimaTian merged commit bfa266d into main Jan 13, 2025
10 checks passed
@SimaTian SimaTian deleted the AZDO-assembly-collision branch January 13, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: MSBuild Task stopped finding MSBuild.exe file correctly
4 participants