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

MSB6004 Missing "ProgramW6432" environment variable on 32-bit systems #25887

Closed
chrisdaiii opened this issue Jun 7, 2022 · 1 comment
Closed
Assignees
Milestone

Comments

@chrisdaiii
Copy link

On 32-bit systems use:
dotnet msbuild WebApplication1.csproj -t:publish /p:PublishProfile=IISProfile

Output error:
C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.Net.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(171,5): error MSB6004: The specified task executable location "%ProgramW6432%\IIS\Microsoft Web Deploy V3\msdeploy.exe" is invalid.

The system has installed 32-bit WebDeploy, and the publish can be successful only after I manually set the "ProgramW6432" environment variable. Is this a bug of dotnet or msbuild?

@rainersigwald rainersigwald transferred this issue from dotnet/msbuild Jun 7, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-WebSDK untriaged Request triage from a team member labels Jun 7, 2022
@rainersigwald
Copy link
Member

Looks like a bug in the MSDeploy task:

if (string.IsNullOrEmpty(m_exePath))
{
string programFilesX86 = System.Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%");
string msdeployExePath = System.IO.Path.Combine("IIS", "Microsoft Web Deploy V3");
m_exePath = IO.Path.Combine(programFilesX86, msdeployExePath);
if (!IO.File.Exists(IO.Path.Combine(m_exePath, ToolName)))
{
string programFiles = System.Environment.ExpandEnvironmentVariables("%ProgramW6432%");
m_exePath = IO.Path.Combine(programFiles, msdeployExePath);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants