Visual Studio with Qt VS Tools Throws "Object reference not set to an instance of an object" When Opening Qt Project File - c++

Hi I have a hopefully simple issue. When I try to open an existing Qt project file in Visual Studio 2019 by going to Extensions -> Qt VS Tools -> Open Qt Project File then selecting the project I get the error message "Object reference not set to an instance of an object". I have set the Qt version properly I think as in the screenshot. Any idea what might be wrong? There is a bin folder in the Qt install folder which contains qmake.exe and everything else but using that folder doesn't fix anything. One possibly important detail is that the Qt project points to files located on a mapped drive for a network share. Qt Creator opens the project just fine. Thanks!

finally I found the solution:
open the project settings file yourproject.vcxprj with a test editor
find the property group "globals"
<PropertyGroup Label="Globals">
<ProjectGuid>{AAAA-AAA-AAAAA-AAAA}</ProjectGuid>
<Keyword>QtVS_v302</Keyword>
Change the Keyword property to "QtVS_v302" as above.
Open the solution with Visual Studio and now QT Tools should work
In my case keywork was "Qt4VSv1.0" that probably was the setting of an old version of QT Tools that now is obsolete.

I wanted to post this as a comment rather than another answer, but the reputation system blocked me.
Mattia's answer solved the issue for me but I needed to use QtVS_v304 rather than QtVS_v302. It seems that Qt has created another project format.

Related

"Manage Client-Side Libraries" menu not appearing

I'm trying to use the new Library Manager (LibMan) feature in Visual Studio 2017 (I'm using Version 15.7.1) but it is not appearing on either the project context menu or the Project menu.
I have tried various web projects but I can't see it for any of them. The only project type I haven't tried is ASP.NET Core 2.1 (I don't have the preview installed) but I can't find any docs that say it only works with ASP.NET Core 2.1
Here is a screenshot to prove it's not there:
had the same issue. I found the answer two it on another site, but for the life of me cannot find it for reference right now. The easiest thing to do is to build it yourself and install it. Works perfectly fine, I did it and now have the Manage Client Side libraries showing up.
Clone / download the Library Manager from GitHub. (https://github.com/aspnet/LibraryManager/)
Build it in Visual Studio 2017
Run the .Vsix installer
Begin to use the Manage Client Side Libraries from the context menu or project menu.
Hope this helps.
For me, in VS 2022 the context menu option appears but the dialog doesn't show. I found out that instead of right-clicking on project item i have to right-click on wwwroot item and then the dialog is shown
Even though Visual Studio Community 15.7.5 references the "Library Manager" it looks like it is still in Preview and to be released with VS 15.8.
If you would like to use the Library Manager now it is fairly easy but there are a few work arounds right now to get it to install, probably a reason it is still in Preview.
Clone or Download the source code
Note: This requires the Visual Studio extension development Workload to be installed (Tools -> Get Tools and Features under "Other Toolsets").
According to this issue on GitHub it will not install, before compiling the Extension open the project file for the LibraryManager.Vsix project
[LibraryManagerDir]\src\LibraryManager.Vsix\Microsoft.Web.LibraryManager.Vsix.csproj
and update (line #30)
<IsProductComponent>false</IsProductComponent>
After 15.8 comes out this needs to be reset back to true to be able to install it.
Open the LibraryManager.sln and make sure to change the Configuration to Release and Build the Solution.
This will create a .vsix install file:
[LibraryManagerDir]\src\LibraryManager.Vsix\bin\Release\Microsoft.Web.LibraryManager.vsix
Open Microsoft.Web.LibraryManager.vsix to launch the Visual Studio Installer.
Then you will have the Add->Client Side Library in your Context Menu.

Profile a c++ win32 console application with Visual Studio 2012

I have a simple (not so simple) win32 console application in c++. I would like to profile this application, but when I try to:
DEBUG > Start Performance Analysis
An error occurs: "No launchable projects are available for profiling".
Please note that the project compiles and runs normally. It's jus the profling that is not working.
How can I solve? I am on Windows 8 with Visual Studio Ultimate 2012
Note that I choose for this project a simple:
File > New Project > Win32 > Win32 Console Application (C++)
I would like to obtain something like xcode does.
A simple list for each functions or methods the cumulative time of usage.
This is the error when I try "Start performance analysis"
Note
I have tried both release mode and debug mode with both x64 and or Win32
Note2
In this project I have created two custom property sheet (to include the right opencv libraries)
- OpenCV-Release
- OpenCV-Debug
Note3
Open the projects properties.> Configration Manager > Active Solution Platform > select New > and follow my screen shot. Your perfomance analysis will run after this.
The project is not being recognised, as you have it configured with x64. (As evidenced by your first screenshot under Note)
Win32
As your project is created in the 64bit os, you need to manually link the project with the win32 sys, so the profiler will recognize the project as a win32 project.
http://en.wikipedia.org/wiki/Windows_API
I will leave this here, as it may be useful for some users.
Saving projects in Visual Studio, must be done methodically and consistently.
If a project is created and saved in a folder (for example) Folder A within the C drive and then later the folders are rearranged and the project is then in Folder A, but folder A has been moved to the D drive (or any variation of changes). Visual Studio, will not be able to find the project.
Be sure to check that all your files for this project are in the correct folders. You need to open the sub folder and make sure that all the files for your project are present.
Please see my screen shots. It doesn't matter why my folders are arranged, as they are, suffice to say, I have found it easier to keep them with the program files in the C drive.
Please note the file in the first screen shot extension vspx, is a visual studio performance report.
Visual Studio Project Folder
Visual Studio Sub Folder
This may or may not answer your question. Please advise if you need more assistance.
The short cut-
VS Release
The long steps - which give you more options
VS Debug menu
VS Configuraion Manager
Please try this (it is the same answer on both links):
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/56dcdb2a-5e30-4015-bc14-244f99f07b8b
Profiling with CMake, C++, and Visual Studio 2012
And this link as well.
Add the files to a directory outside of the project and then reference those directories in the "Additional Include Directories" in Properties -> Configuration Properties -> C/C++ -> General.
VC++ Visual Studio added .hpp files in subdirectory but get "Error: cannot open source file ..."
You can launch the performance wizard, under the Analyze tab.
This is a known bug in VS.
Without seeing your computer, it is hard to know what else, I can suggest. I do know that it's important to go through all the suggested steps to trouble shoot. If I can find anything else, I'll let you know.
Please note my project is a downloaded sample.

How can i change my c++ project name and my solution name?

I'm not sure if this is the problem but.
On the solution explorer i changed the project name and the solution name and after hat when i try to run my application i'm getting an error:
myapp.exe :
The application was unable to start correctly (0x000007b). Click OK to
close the application.
Maybe i need to change some directories on the hard disk too if i changed the project and solution names in the solution explorer ?
I have Visual Studio 2012 pro the project is C++ console application. Worked good and nothing changed. Started to make this error after changed name of project and solution.

"There's no Qt version assigned to this project for platform Win32" - visual studio plugin for Qt

I have a Qt project I am working on in Visual Studio 2010, with the Qt Visual Studio Add-in (for Qt 4.8). The project is running fine on my work machine, and I am trying to run it on my home machine. When I try to build, I get the following error:
There's no Qt version assigned to this project for platform Win32.
Please use the 'change Qt version' feature and choose a valid Qt
version for this platform.
However, it's set up to use a valid Qt version (another project I'm working on at home uses this plugin as well). Why is this occurring? When I got to Qt -> Qt Options, I see a valid version (4.8.0). Thanks
Did you select a proper Qt version in the Qt settings of your project?
More detailed:
If you right-click on the project there should be a "Qt Project Settings" option (or similar - I use the german version) near the end of the context menu. In there you can set the Qt version that this specific project uses. Is this one possibly not set correctly?
Solution:
Right click your project;
Qt Project Settings;
Under the Properties tab, you will find the option Version;
change it to a proper value;
Now, go ahead with your project.
Hope to help
Had the same problem with a x64 Visual Studio 2019 solution on Windows using Qt 5.15.0. Based on the answer from #Fabian and the excellent comment from #sitting-duck:
Install the Qt VS Tools extension
Select Extensions > Qt VS Tools > Qt Options
On the Qt Versions tab click Add
Set "Version Name" to something like "Qt-5.15.0"
Set "Path" to "[QT-PATH]\5.15.0\msvc2019_64"
Open Project Properties > Qt Project Settings > General > Qt Installation
Ensure this is set to "Qt-5.15.0" and close Project Properties
Right-click the solution (in the Solution Explorer tab) and select Change Solution's Qt Version
Ensure Qt-5.15.0 is selected
You should be good to go.
Open vcxproj file in a notepad, look for QtVersion...something=...
Ensure that the version value is really 4.8.0 (or whatever is your actual QT SDK version).
I found this issue too. and I found the solution .
you must keep the Qt version name is exactly same with the project create using.
which you think u can change freely,but actually not.
If you want to move Qt project between different computers, it's a good idea to use the qt project file, and not the MSVC (.vcxproj) one. So when you move from your work machine home, create a .pro file (in the Qt menu, you find the neccessary options to do that), and then load the .pro file at home, again using the Qt menu inside MSVC.
Another thing this could be is the platform being used is not the platform you think it is. In MSVC right-click on project, select properties, and then press configuration manager. Then check that all configurations and platforms are as you expect them to be.
I got the same problem during migration from Qt5.9 to Qt5.10.
We have a solution (Visual Studio) which consists of many projects. Some of them have QtVersion = "Qt5.9" and others have QtVersion = "Qt5.7" (yes, it were inaccurate project settings)
So, after I change all Qt project's settings from 5.9 to 5.10 automatically and remove Qt5.7 from versions list - I got the same error. This error was fixed trivially - I just add back Qt5.7 to the versions list (temporary until ALL projects' Qt version was not changed to 5.10).
In my case, I ported a Visual Studio project, with all its files (including .sln, .vcxproj, etc) to another computer using git. When I set everything up on the new computer, I accidentally selected a different folder for the Qt executables in VS (I selected C:\Qt\5.9.9\winrt_x86_msvc2017 instead of C:\Qt\5.9.9\msvc2017_64). When I double-checked which I had selected on the original computer, and then selected the same on the new computer, all was good.
To select a Qt folder: Extensions -> Qt VS Tools -> Qt Options -> Add -> Path (Version Name is auto-filled once you select the path).
This all describes the process using Visual Studio 2019, with the Qt plugin found here.
You could follow AlainD's instruction.
It work for me.
Just Right-click on Solution -> Change Solution's Qt Version
It will make change for its all projects.

Visual Studio 2010 C++ native debug mode resources

I am very desperate now...
I have project in Visual C++ 2010 using Qt and OpenCV. I got to phase I need to load XML file using openCV. But, I have no idea where is the working directory of my project, when run thru VS (F5). I mean, I read all config, copied desired file almost everywhere in my project folders, but it still is not seen by my EXE (OpenCV)...
What Am I doing wrong? Thanks.
right click on your project click on properties/Configuration Properties/debugging you start in whatever working directory is set to.