microsoft / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
270 stars 79 forks source link

How to choose vs 2017 when execute phpsdk-vc15-x64.bat? #79

Closed huanghantao closed 3 years ago

huanghantao commented 3 years ago

I installed VS2017 and VS2019 at the same time, and when I finished executing phpsdk-vc15-x64.bat, I found that it chose VS2019 by default:

which cl.exe
/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe
cmb69 commented 3 years ago

Cygwin is probably not supported. Does it work if you use phpsdk-vc15-x64.bat or phpsdk-vc15-x86.bat to start a cmd shell? where cl.exe reports the desired Visual Studio 2017 for me.

pierrejoye commented 3 years ago

I would suggest to always open a vs dev command line.

On Mon, Sep 6, 2021, 5:47 PM Christoph M. Becker @.***> wrote:

Cygwin is probably not supported. Does it work if you use phpsdk-vc15-x64.bat or phpsdk-vc15-x86.bat to start a cmd shell? where cl.exe reports the desired Visual Studio 2017 for me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/php-sdk-binary-tools/issues/79#issuecomment-913548686, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACE6KBR3VJHKUDA5B7X6N3UASL37ANCNFSM5DQFSARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cmb69 commented 3 years ago

I would suggest to always open a vs dev command line.

This shouldn't be necessary with somewhat recent versions of the PHP-SDK, since there is some quite elaborate code to detect the desired VS version. This should work even for different editions of Visual Studio, e.g. VS 2017 Enterprise and VS 2019 Community.

pierrejoye commented 3 years ago

ah nice, when I wrote it there were always edge cases not working well outside it.

Also now the SDKs are cleaner. :)

On Mon, Sep 6, 2021, 6:22 PM Christoph M. Becker @.***> wrote:

I would suggest to always open a vs dev command line.

This shouldn't be necessary with somewhat recent versions of the PHP-SDK, since there is some quite elaborate code to detect the desired VS version. This should work even for different editions of Visual Studio, e.g. VS 2017 Enterprise and VS 2019 Community.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/php-sdk-binary-tools/issues/79#issuecomment-913570589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACE6KDGUXFPXEC3XFFIL43UASP6ZANCNFSM5DQFSARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cmb69 commented 3 years ago

For recent VS versions, we can rely on vswhere.exe instead of probing the registry. :)

pierrejoye commented 3 years ago

for 2017 or newer yes.

There is another before but I can't find it back :)

On Mon, Sep 6, 2021, 7:07 PM Christoph M. Becker @.***> wrote:

For recent VS versions, we can rely on vswhere.exe instead of probing the registry. :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/php-sdk-binary-tools/issues/79#issuecomment-913596347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACE6KHPDU6TI5F4GGS2S2TUASVHJANCNFSM5DQFSARQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

huanghantao commented 3 years ago

Thank you. According to your tips, the problem has been solved.