Closed MathiasMagnus closed 6 years ago
VSWhere is used to find Visual Studio installations. If it's returning installs with the same name, the earlier returned ones will be overridden. Could you show the output of VSWhere using the -legacy -all -format json -products *
flags?
Output as follows
PS C:\Users\Matty> & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -legacy -all -format json -products *
[
{
"instanceId": "f8ffb12d",
"installDate": "2017-03-07T19:32:57Z",
"installationName": "VisualStudio/15.2.0+26430.16",
"installationPath": "C:\\Kellekek\\Microsoft\\Visual Studio\\15",
"installationVersion": "15.2.26430.16",
"isPrerelease": false,
"displayName": "Visual Studio Community 2017",
"description": "Free, fully-featured IDE for students, open-source and individual developers",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"channelId": "VisualStudio.15.Release",
"channelPath": "C:\\Users\\Matty\\AppData\\Local\\Microsoft\\VisualStudio\\Packages\\_Channels\\4CB340F5\\catalog.json",
"channelUri": "https://aka.ms/vs/15/release/channel",
"releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660284#15.1.26430.16",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660300"
},
{
"instanceId": "VisualStudio.14.0",
"installationPath": "C:\\Kellekek\\Microsoft\\Visual Studio\\14.0\\",
"installationVersion": "14.0"
}
]
However, best and latest should include prerelease versions as well. I use this 10X more often, than the latest stable.
PS C:\Users\Matty> & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -legacy -all -prerelease -format json -products *
[
{
"instanceId": "e391d431",
"installDate": "2017-04-19T12:02:47Z",
"installationName": "VisualStudioPreview/15.3.0-pre.4.0+26711.1",
"installationPath": "C:\\Kellekek\\Microsoft\\Visual Studio\\Preview",
"installationVersion": "15.3.26711.1",
"isPrerelease": true,
"displayName": "Visual Studio Community 2017",
"description": "Free, fully-featured IDE for students, open-source and individual developers",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"channelId": "VisualStudio.15.Preview",
"channelPath": "C:\\Users\\Matty\\AppData\\Local\\Microsoft\\VisualStudio\\Packages\\_Channels\\48CDB76F\\catalog.json",
"channelUri": "https://aka.ms/vs/15/pre/channel",
"releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660470#15.3.26711.01",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660485"
},
{
"instanceId": "f8ffb12d",
"installDate": "2017-03-07T19:32:57Z",
"installationName": "VisualStudio/15.2.0+26430.16",
"installationPath": "C:\\Kellekek\\Microsoft\\Visual Studio\\15",
"installationVersion": "15.2.26430.16",
"isPrerelease": false,
"displayName": "Visual Studio Community 2017",
"description": "Free, fully-featured IDE for students, open-source and individual developers",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"channelId": "VisualStudio.15.Release",
"channelPath": "C:\\Users\\Matty\\AppData\\Local\\Microsoft\\VisualStudio\\Packages\\_Channels\\4CB340F5\\catalog.json",
"channelUri": "https://aka.ms/vs/15/release/channel",
"releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660284#15.1.26430.16",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660300"
},
{
"instanceId": "VisualStudio.14.0",
"installationPath": "C:\\Kellekek\\Microsoft\\Visual Studio\\14.0\\",
"installationVersion": "14.0"
}
]
This does not address the "sometimes" failing detection with ENOENT errors and such. Any ideas on those?
Unfortunately, it does not at all for me. Running vswhere gives
PS C:\Program Files (x86)\Microsoft Visual Studio\Installer> .\vswhere.exe -legacy -all -format json -products *
[
{
"instanceId": "8d6ed86d",
"installDate": "2017-03-03T07:02:25Z",
"installationName": "VisualStudio/15.2.0+26430.16",
"installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community",
"installationVersion": "15.0.26430.16",
"displayName": "Visual Studio Community 2017",
"description": "Free, fully-featured IDE for students, open-source and individual developers",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"channelId": "VisualStudio.15.Release",
"channelPath": "C:\\Users\\buffo\\AppData\\Local\\Microsoft\\VisualStudio\\Packages\\_Channels\\4CB340F5\\catalog.json",
"channelUri": "https://aka.ms/vs/15/release/channel",
"releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660284#15.1.26430.16",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660300"
}
]
Visual Studio 2017 is not detected at all. :(
@buffos, uhm... have you read through the output? (Either you or I am making a fool of myself.)
"installationPath": "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community", "displayName": "Visual Studio Community 2017",
How much more of 2017 do you want to see in the output?
@MathiasMagnus I see 2017 of course the output of vswhere. CMake tools do not detect Visual Studio though.
p.s I have no problem making me fool of myself. :) p.s nice xbox avatar !
This could be for different reasons, e.g. if vcvarsall.bat
is missing or not everything is installed. E.g. Windows SDK (which weights few gigs) is required.
Can you build with CMake from command line?
@buffos What you might try is when you open a CMake Tools capable folder, check inside the ${workspaceroot}/build folder and catch the batch scripts that the extension executes and uses for build environment detection. They are fairly shortlived (2-4 seconds, depending on your HW), but if you open them with any editor, than they cannot be deleted (because they are opened). There you can see how and where CMake Tools is trying to invoke vcvarsall.bat.
It might get you closer to why the extension fails to find your install.
@MathiasMagnus thx a lot (i never see any file inside build folder. it is created but I never see a file inside it) @ytimenkov It builds fine from the command line
Maybe because I have MinGW installed to and it sees that first and tries to work with that. Can I tell the tools to ignore MinGW and search for another environment
@buffos
Can I tell the tools to ignore MinGW and search for another environment
try setting mingwSearchDirs
to an empty array.
But VS and MinGW installations are searched in parallel so I don't expect this to help.
Indeed no luck, but ok Until I find out what is wrong, I can always build with VS Studio.
I find a way to "fix" it, but it does not make sense. I set "cmake.loggingLevel": "verbose" and now it prints it detects VS....
EDIT: It detects it, but it will not let me select it as a build environment.
@buffos CMakeTools allow to select multiple environments. I.e. you may select both MinGW and VS at the same time. Could you try selecting / deselecting different environments?
@ytimenkov . where is that option? in the status bar it allows me to select one, and it only shows MinGW. Thank you for your time.
@buffos If you don't see Visual Studio in the status bar then for some reason CMake Tools couldn't detect it. There are few things you can do:
Or to work around:
Visual Studio 15 2017
generator. It produces msbuild projects which don't require environment set up. CMake uses registry and msbuild itself uses .props files to locate paths.@ytimenkov Here is the part relevant to the problem. It reports error running a bat file. I went to the location and the bat file runs manually fine. There is also a rejected promise in the console.
extensionHost.ts:320 [Extension Host] Shutting down CMake Tools backend
extensionHost.ts:320 [Extension Host] CMake Tools has been stopped
extensionHost.ts:320 [Extension Host] Starting CMake Tools backend
extensionHost.ts:320 [Extension Host] [cmake output]: cmake version 3.9.0
extensionHost.ts:320 [Extension Host] [cmake output]:
extensionHost.ts:320 [Extension Host] [cmake output]: CMake suite maintained and supported by Kitware (kitware.com/cmake).
extensionHost.ts:320 [Extension Host] cmake exited with return code 0
extensionHost.ts:320 [Extension Host] Loading environments
extensionHost.ts:320 [Extension Host] Loading CMake Tools from c:\Users\buffo\Code\python\prj - selfDrivingCars\carnd-project\11.path.planning\.vscode\.cmaketools.json
extensionHost.ts:320 [Extension Host] Detecting environment: Visual Studio Community 2017 - x86
extensionHost.ts:320 [Extension Host] Detecting environment: Visual Studio Community 2017 - amd64
extensionHost.ts:320 [Extension Host] Detecting environment: Visual Studio Community 2017 - arm
extensionHost.ts:320 [Extension Host] Error running C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat
extensionHost.ts:320 [Extension Host] Error running C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat
extensionHost.ts:320 [Extension Host] Error running C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat
extensionHost.ts:320 [Extension Host] Environments loaded
extensionHost.ts:320 [Extension Host] Detected available environment "MinGW - C:\MinGW
extensionHost.ts:320 [Extension Host] Started new CMake Server instance with PID 55040
shell.ts:443 Invalid backend promise: Error: Invalid backend promise
at CMakeToolsWrapper.<anonymous> (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:267:44)
at Generator.next (<anonymous>)
at C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:13:65
at __awaiter (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:9:12)
at CMakeToolsWrapper.shutdown (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:264:16)
at CMakeToolsWrapper.<anonymous> (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:280:24)
at Generator.next (<anonymous>)
at C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:13:65
at __awaiter (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:9:12)
at CMakeToolsWrapper.restart (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:278:16)
at CMakeToolsWrapper.<anonymous> (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:75:28)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\buffo\.vscode\extensions\vector-of-bool.cmake-tools-0.10.2\out\src\wrapper.js:10:58)
at process._tickCallback (internal/process/next_tick.js:103:7)```
@buffos Which parameters did you pass to VsDevCmd.bat
? It should be something like:
VsDevCmd.bat -no_logo -arch=amd64
As for rejected promise, it may be not an issue, just a side effect. It is definitely not related to environment detection.
@ytimenkov Did not pass anything. It's the output from the console ('Help' -> 'Toggle Developer Tools') It's not saying anything else. (sorry if this sounds too stupid. I thought it was auto detecting and I did not need to do anything.)
Closed. If this issues still persists in the current 0.11.0-beta4, feel free to reopen this one or create a new one.
Hi!
I was happy to see that environment detection finally works. I gave it a spin, and my milage was rather mixed depending on... stellar constellations? Sometimes it works, sometimes is doesn't.
First of all, it's strange that even though I got two VS instances installed (one regular, and one insider (preview) version, both kept up do date), CMake Tools shows only two variations to chose from: x86 and amd64 toolsets. Moreover, it picks up the "older", non-preview toolset which I use far less frequently. (Bleeding edge tools and C++, ALWAYS). The output window reads:
but upon clicking the status bar button, I can only select from x86 and amd64, as if some name collision would occur.
Second, sometimes CMake configure just fine, and sometimes it fails to find the compiler, even after selecting amd64.
CMakeError.txt CMakeOutput.txt
Third, after opening a trivial (CMakeLists.txt + Main.cpp) folder, it says:
and the output window reads:
Error: spawn cmake ENOENT
Something seems off. Am I doing something wrong?