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

SlnGen fails under VsDevCmd environment. #436

Open
jogietze opened this issue Jan 5, 2023 · 3 comments
Open

SlnGen fails under VsDevCmd environment. #436

jogietze opened this issue Jan 5, 2023 · 3 comments

Comments

@jogietze
Copy link

jogietze commented Jan 5, 2023

The "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" batch file sets up the PATH environment variable to include, for example:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\\MSBuild\Current\Bin\amd64

Your detection logic here...

https://github.com/microsoft/slngen/blob/main/src/Shared/DevelopmentEnvironment.cs#L182

...appends an extra amd64 without checking if the path exists, and fails:

D:\src>slngen
Unhandled exception: System.IO.FileNotFoundException: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\amd64\MSBuild.exe
  at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
  at Microsoft.VisualStudio.SlnGen.Program.Main(String[] args) in D:\a\_work\1\s\src\Microsoft.VisualStudio.SlnGen.Tool\Program.cs:line 81
@jeffkl
Copy link
Collaborator

jeffkl commented Jan 5, 2023

That logic is in an if statement for only when the current runtime is 64-bit but the MSBuild.exe found is not 64-bit. Is this from a 32-bit development environment? I'm curious how its finding the 64-bit MSBuild.exe but doesn't think the current process is already 64-bit.

@jeffkl
Copy link
Collaborator

jeffkl commented Jan 21, 2023

@jogietze Have you tried the latest version and still hit this? I think I saw it happen yesterday but when I updated SlnGen to the latest version it started working.

@jogietze
Copy link
Author

jogietze commented Aug 3, 2023

The issue comes and goes. It's reasonably easy to work around by updating %PATH%.

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

No branches or pull requests

2 participants