Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while using Qt in Visual Studio 2019

I am trying to use Qt in Visual Studio 2019. I installed the extension "Qt VS tools" in VS and added my Qt path. I created a new Qt Gui Application project in VS. Without changing anything I get the error

  == Qt Visual Studio Tools version 2.4.2

   Initialized in: 14169,6 msecs
   Main (UI) thread: 292,38 msecs

TestQT.vcxproj: background build FAILED!
TestQT.vcxproj: background build FAILED!
TestQT.vcxproj: background build FAILED!

as output from Qt VS tools and if I try to build this project I get

1>------ Rebuild All started: Project: TestQT, Configuration: Debug x64 ------
1>Reading Qt configuration (C:\Qt\5.14.0\msvc2017_64\bin\qmake.exe)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018: The "GetVarsFromMakefile" task failed unexpectedly.
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018: System.ArgumentException: An item with the same key has already been added.
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at InlineCode.GetVarsFromMakefile.Execute() in c:\Users\tom\AppData\Local\Temp\2zkteh3y.0.cs:line 71
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "TestQT.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I'm sorry for this newbie question but I googled for hours now...

like image 592
llTtoOmMll Avatar asked Mar 04 '23 01:03

llTtoOmMll


2 Answers

Install rev.09 version of extension from https://download.qt.io/development_releases/vsaddin/2.4.2/ Here is bug report and solution in comments if you want more info https://bugreports.qt.io/browse/QTVSADDINBUG-722

like image 93
Ravgni Avatar answered Mar 05 '23 19:03

Ravgni


Rev. 14 solved the problem. I can use 5.14 with VS2019

like image 22
SepGuest Avatar answered Mar 05 '23 18:03

SepGuest