Package manager console in VS 2017 cannot run exe file located in %windir%\system32 - visual-studio-2017

A hello world C# x64 application created in Visual Studio 2017 is executed successfully via Package Manager Console (PMC) everywhere else except %windir%\system32 location. The strange thing is that it is executed in Windows PowerShell (not as admin) but not from PMC in Visual Studio 2017. I thought it was an issue of the execution policy, but it was not. I changed the execution policy in PMC to match the windows PowerShell execution policy, but it didn't make any difference. I also executed the command Set-Location $env:windir\system32 and then Get-Location to confirm it, but it had no effect. Any ideas?System: win7x64Visual Studio 2017 15.6.0

I figured it out. Actually i had to do exactly the opposite. Visual Studio is 32-bit and therefore prefer 32-bit option must be selected in the executable build options in C#. Then the executable must be stored in %windir%\syswow64 and everything works fine.

Related

exe file doesn't work outside visual studio 2022

I've just installed visual studio 2022 current.Inside the environment everything works fine but i'd like to create a standalone executable. I have tried everything,downloaded microsoft c++ 2022 redistributable,the standalone build tools,tried debug and release version but when i click on the .exe of the project,nothing happens.
The program is the simple "hello world!".
To successfully run an EXE you built in Visual Studio on another computer, that computer needs to have the Visual C++ runtime installed. Install these bits on the target computer.
Alternatively, you can just link the EXE statically to the C++ runtime. More details on how to statically link your EXE at my old answer on this topic here

Visual Studio 2017 debugger fails connected to a ClearCase mapped drive

I'm using Visual Studio 2017 with a ClearCase dynamic view connected to a mapped drive.
Starting a debugger session fails with:
Unable to start program filename.exe.
Operation is not supported.
Unknown error: 0x80070057.
Using a ClearCase snapshot view, the debugging session works as expected, without error message.
Visual Studio 2013 works perfectly fine with a snapshot or dynamic view.
Any help would be appreciated.
It depends on your exact ClearCase version, as seen in this PI45450 (project issue, similar but not identical to your case)
PI45450: RUNNING AN .NET EXECUTABLE IN A DYNAMIC VIEW FAILS WITH RUNTIME ERROR SYSTEM.ARGUMENTEXCEPTION 0X80070057 (E_INVALIDARG)
Recommendation:
Running the executable by specifying its fully qualified UNC
pathname may work, such as
\\view\viewtag\vobtag\<application>.exe
In your case, with Windows:
m:\viewtag\vobtag\<application>.exe
See if the full path (M:\...\<application>.exe) works better with Visual Studio 2017.
Or try and upgrade ClearCase if possible (8.0.1.10+).
There is a new ClearCase APAR for this behavior, because it was initially reported only if the CC VS 2017 integration was installed. It actually doesn't need the integration, at least not on Windows 10 with UAC on. The APAR is PI86014, but it may not be visible yet as it's really new.
The issue is specific to Visual Studio 2017, Visual Studio 2015 will open and start the debug session fine, and the debug executables load just fine from a dynamic view.
The integration released in the technote seems to be a little buggy. Perhaps the one in 9.0.0.5 and 9.0.1.1 will behave better.

Unrecognized error occurred in the Windows Web Services framework

I'm trying to build and run a simple project in Visual Studio 2017 (C++) in x64 using the Local Windows Debugger. However every time I try to run it using the debugger I get this error.
This error doesn't show up when I change it from x64 to x86, but I need it to compile to x64. This has happened on both computers that I've tried it on, and seems to happen in every one of my projects. I've tried reinstalling Visual Studio already and nothing's changed. I've tried adding 'devenv.exe' as an exception to the Windows Firewall but no changes there either, even when I disabled the firewall completely. My antivirus isn't affecting it at all either: still happens when I disable it.
The application runs fine when I find it in the explorer and run it manually but then I don't have any debugging tools.
What am I doing wrong here, how do I make it build and run my project as x64?
I get this error every time I have an active VPN connection. If you use a VPN, try disconnect and see if the error disappears.
If you want to use a VPN, the solution (assuming you have Visual Studio 2017 Version 15.7 or later) is as follows:
Go to the Windows Start Menu and launch the “Developer Command Prompt for VS 2017 Preview”
Run: "%DevEnvDir%vsregedit.exe" set "%VSINSTALLDIR:~0,-1%" HKCU Debugger UseAnonymousPipes dword 1
Restart VS if it is already running
That solution is from this link to Microsoft.

running visual studio release build .exe file in different machines

I have built a visual studio c++ console application(x64 release build). The .exe file in the release folder runs fine with the required dlls.
When i try to run it on other machine it throws error
The Application was unable to start correctly (0xc000007b). Click OK to close the application
There is no x86-x64 lib mismatch issues.
In another machine it works well.I don't know whether it needs any resource to run the .exe
I have tried building the application statically still no results..
1)It is possible the new machine is missing important software like .NET framework or something similar. Please install the other frameworks and then try to run it on other machine.
2)If new machine has other OS try to run program in compatibility mode
You need the same Visual Studio redistributable .dlls on your target machine.
You'll either need to install the redistributable or install visual studio on that machine.
Also note that it makes a difference whether you're using Express or not.
So you can't develop on Visual Studio 2008 Express and then install the Visual Studio 2008 Redistributable.

'cl' is not recognized as an internal or external command,

I am trying to compile a hello world program in Qt Using Qt Creator.
I am getting 'cl' is not recognized as an internal or external command.
I am using Windows 7 and both VS 2008 and 2010 installed in it.
When I use Mingw it is compiling fine but if use vs 2008 it is giving this error.
After Setting Env Path = ..;..;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin also it is showing the same error.
That error happens because cl isn't in your path. You need to add it there. The recommended way to do this is to launch a developer command prompt.
Quoting the article Use the Microsoft C++ toolset from the command line:
On the desktop, open the Windows Start menu. In Windows 11, choose the All apps button to open the list of installed apps. In Windows 10,
the list is open to the left. Scroll down the list to find and open
the folder (not the app) for your version of Visual Studio, for
example, Visual Studio 2022.
In the folder, choose the Developer Command Prompt for your version of Visual Studio. This shortcut starts a developer command
prompt window that uses the default build architecture of 32-bit,
x86-native tools to build 32-bit, x86-native code. If you prefer a
non-default build architecture, choose one of the native or cross
tools command prompts to specify the host and target architecture.
For an even faster way to open a developer command prompt, enter
developer command prompt in the desktop search box. Then choose the
result you want.
As the article notes, there are several different shortcuts for setting up different toolsets - you need to pick the suitable one.
If you already have a plain Command Prompt window open, you can run the batch file vcvarsall.bat with the appropriate argument to set up the environment variables. Quoting the same article:
At the command prompt, use the CD command to change to the Visual Studio installation directory. Then, use CD again to change to the
subdirectory that contains the configuration-specific command files.
For Visual Studio 2019 and Visual Studio 2017, use the
VC\Auxiliary\Build subdirectory. For Visual Studio 2015, use the VC
subdirectory.
Enter the command for your preferred developer environment. For example, to build ARM code for UWP on a 64-bit platform, using the
latest Windows SDK and Visual Studio compiler toolset, use this
command line:
vcvarsall.bat amd64_arm uwp
From the article, the possible values for the first argument are the following:
x86 (x86 32-bit native)
x86_amd64 or x86_x64 (x64 on x86 cross)
x86_arm (ARM on x86 cross)
x86_arm64 (ARM64 on x86 cross)
amd64 or x64 (x64 64-bit native)
amd64_x86 or x64_x86 (x86 on x64 cross)
amd64_arm or x64_arm (ARM on x64 cross)
amd64_arm64 or x64_arm64 (ARM64 on x64 cross)
I had the same problem.
Try to make a bat-file to start the Qt Creator. Add something like this to the bat-file:
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
"C:\QTsdk\qtcreator\bin\qtcreator"
Now I can compile and get:
jom 1.0.8 - empower your cores
11:10:08: The process "C:\QTsdk\qtcreator\bin\jom.exe" exited normally.
Make sure you restart your computer after you install the Build Tools.
This was what was causing the error for me.
I had the same problem and I solved it by switching to MinGW from MSVC2010.
Select the Project Tab from your left pane. Then select the "Target". From there change Qt version to MinGW instead of VC++.
You will have to set environmental variables properly for each compiler. There are commands on your Program menu for each compiler that does that, while opening a command prompt.
Another option is of course to use the IDE for building your application.
I had this problem because I forgot to select "Visual C++" when I was installing Visual Studio.
To add it, see: https://stackoverflow.com/a/31568246/1054322
I had the same issue for a long time and I spent God knows how much on it until I accidentally figured what to do. This solution worked on windows 10. All you need to do is to add C:\WINDOWS\System32 to Path variable under User Variables in Environmental Variables... Note that if you add this to the system variables, it may also work. But, that didn't work for me.
You can use Command prompt for VS 2010 and then select the path that your boost located. Use "bootstrap.bat", you can successfully install it.
For me, this was related to the scenario described by Smi, with the difference being that vcvarsall.bat itself was failing due to an invalid path.
This was cause by line-breaks within the path, which meant vcvarsall.bat couldn't find the common tools directory for some reason.
I sometimes get this problem when changing from Debug to Release or vice-versa. Closing and reopening QtCreator and building again solves the problem for me.
Qt Creator 2.8.1; Qt 5.1.1 (MSVC2010, 32bit)
I faced this error too, checked that there are multiple versions of common tool variables for visual studio in my environment variables (VS120COMNTOOLS, VS110COMNTOOLS and so on) for different visual studio versions.
I removed the ones I did not need from the environmental variables and the issue was resolved.
I was facing the same issue and tried many solutions but nothing work ( I was using vscode 2017) . I just upgraded vscode to 2022 version and the problem is automatically