Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building x64 C++ project from command line says: This operation should only take place on the UI thread

Visual Studio 2013 has a problem when building, it displays an error message as follows:

c:>devenv /build debug /project (project name) /projectconfig "debug|x64" (solution Name).sln

1>This operation should only take place on the UI thread.

like image 313
Amit Avatar asked Apr 01 '15 06:04

Amit


People also ask

How to build a C/C++ project at the command line?

The vcvarsall.bat file has additional information about specific version numbers. To build a C/C++ project at a command prompt, Visual Studio provides these command-line tools: Use the compiler (cl.exe) to compile and link source code files into apps, libraries, and DLLs.

What is the target for the x64 native tools command prompt shortcut?

For example, the target for the x64 Native Tools Command Prompt for VS 2017 shortcut is something similar to: %comspec% /k "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvars64.bat". Open the Properties dialog for a developer command prompt shortcut to see the command target used.

Can I build apps on the command line With MSBuild?

Starting in Visual Studio 2019 version 16.5, MSBuild and DEVENV don't use the command-line environment to control the toolset and libraries used. These articles show how to build apps on the command line, and describe how to customize the command-line build environment.

What is the best way to execute MSBuild without Visual Studio?

MSBuild runs in containerized build environments, and supports a binary logger. Use DEVENV (devenv.exe) combined with a command-line switch such as /Build or /Clean to execute certain build commands without displaying the Visual Studio IDE.


2 Answers

I just ran into this with Visual Studio 2015 compiling C++ code (error: This operation should only take place on the UI thread). Finally traced it to the .vcxproj.filters file for the project that was failing to compile. This file had been merged from another code stream and was missing a closing "ClCompile" XML tag in one spot. Apparently this leads to the error, although compiling in the IDE worked fine.

like image 105
Dave Avatar answered Oct 08 '22 01:10

Dave


There is a workaround : use

msbuild /p:Configuration=Debug;Platform=x64 (solution Name).sln..

moreover I have no issues using devenv /build once I have used msbuild.

Black magic !

like image 20
Amit Avatar answered Oct 08 '22 02:10

Amit