1

I got this error while building a Qt 5.8 project in Visual Studio 2015 community edition, and am unable to resolve this.

1>------ Rebuild All started: Project: analogclock, Configuration: Debug Win32 ------
1>  Generate moc_predefs.h
1>  Reading Qt configuration (D:\Qt\Qt5.8.0\5.8\msvc2015\bin\qmake.exe)
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error : The source file for this compilation can be found at:
 "C:\Users\Dan\AppData\Local\Temp\25ee8a4c-842c-4329-96bc-cd757b4f3616.txt"
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB3758: 
    An error has occurred during compilation. warning CS1668: Invalid search path 'Lib\um\x86' 
    specified in 'LIB environment variable' -- 'The system cannot find the path specified. '
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB3758:
     An error has occurred during compilation. c:\Users\Dan\AppData\Local\Temp\qmousnkh.0.cs(88,26) : error CS1061: 
    'System.Collections.Generic.IEnumerable<string>' does not contain a definition for 'ToHashSet' 
    and no extension method 'ToHashSet' accepting a first argument of type 'System.Collections.Generic.IEnumerable<string>' 
    could be found (are you missing a using directive or an assembly reference?)
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4036: 
    The "GetVarsFromMakefile" task was not found. Check the following: 
    1.) The name of the task in the project file is the same as the name of the task class. 
    2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 
    3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks 
        files located in the "C:\Program Files\MSBuild\14.0\bin" directory.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
David Buck
  • 3,752
  • 35
  • 31
  • 35
Dan
  • 31
  • 4

1 Answers1

1

I had the same error and I hope my solution can help you (despite of that almost one year passed from time when you asked:-)) or others having it. Shortly - try to update .Net Framework at least to version 4.7.2.

After some investigation I found that QT VS Tools use pieces of C# code in custom build scripts. One of them is GetVarsFromMakefile in file qt_vars.targets. I copied this code to new C# project, added missing variables and had the same error as during compiling of QT project: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'ToHashSet'... The problem was that this method was added to the mentioned class only at .Net 4.7.2 (https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1?view=netframework-4.7.2) and I had .Net 4.6. Probably during install of newer versions of Visual Studio newer .Net version is installed automatically, but I have VS 2015. After updating to latest .Net version (I tool 4.8) this issue has gone.

Zombie
  • 11
  • 1