Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio doesn't see all files in System32

I set some post-build commands in Visual Studio 2017 that should allow me to run a program that I currently have in System32 (wsl.exe). However, Visual Studio doesn't see the program.

I tried to set the command to dir C:\Windows\System32\ to see all the files it could list, and in fact it doesn't list over a 1'000 files out of the around 4'600 files I have there, including the wsl.exe file I'm trying to run. The number of files show up correctly when running the same command in the command prompt.

I've tried to run whoami as the post-build command, and it returns the same user as if I run the same command in the command prompt.

Am I missing something?

like image 459
Peter Avatar asked Sep 10 '18 08:09

Peter


People also ask

How do I unhide in System32?

Click on the "Appearance and Personalization" link. Then click "Folder Options." Go to the "View" tab. Deselect the box next to "Hide protected operating system files (Recommended)." In Windows Vista, select "Show hidden files and folders." In Windows 7, select "Show hidden files, folders, and drives." Click "OK."

Where are System32 files stored?

A required Microsoft Windows system directory, the System32 directory is located in either C:\Windows\System32 or C:\Winnt\system32 directory. The system32 directory contains Windows system files and software program files, vital to the operation of the Windows operating system and software programs running in Windows.

How do I navigate to C Windows System32?

Typing cd \ will move you from any folder on the drive to the root folder of that drive. If you're in C:\Windows\System32 , type cd \ and press Enter to move to C:\ . If the path has spaces, enclose it in double-quotes.

How to find if a file exists in System32?

The PLASRV.EXE file only exists in system32. Doing a DIR from the cmd line find the file. Outside using CreateFile on the backend to determine if a file exists, which is what both of the methods done so far do, the other way is to use FindFirstFile/NtQueryDirectoryFile which is what I believe cmd does.

How to show all files in a solution folder?

"Show All Files" option found on the top of solution explorer. Honestly, I hadn’t even noticed before that solution explorer has a “Show All Files” option. Turning this on show everything in your solution folder that isn’t part of the project.

What does “show all files” do?

If you set “Show All Files”, you can select an existing folder that is not part of the project, and “Include In Project”. This solved my issue, but it may also come in handy in the future when manually adding third-party libraries, or just viewing the node_modules folder.

How do I show all files in a project?

It only shows the files and folders that are included in your project by default. At the top of the solution explorer panel there should be a button that says "Show All Files" which will allow you to select grayed-out ones that exist but aren't included yet, right click them, and say "Include in Project".


1 Answers

Visual Studio itself is 32-bit application. As such, the OS shims the application behavior to a different view of the Windows and System32 folders. i.e c:\Windows\System32 in the application is actually the c:\Windows\SysWow64 folder for 32-bit apps. That explains why it can't see the wsl.exe binary... Not sure what the workaround is... looking into this...

like image 69
selbie Avatar answered Oct 21 '22 03:10

selbie