qt-labs / vstools

Other
77 stars 24 forks source link

Qt DLLs not found (QtMsBuild) #15

Closed Splixz00 closed 1 year ago

Splixz00 commented 1 year ago

Describe the bug Qt DLLs not found

To Reproduce Run your application with the Visual Studio Local Windows Debugger with the default value in Project->Properties->Debugging->Environment (Settings that are set by the extension/.props files in QtMsBuild).

Expected behavior When using the vs extension in a VS Qt project, it automatically sets the value for LocalDebuggerEnvironment and it should reference the path to the DLLs in your Qt Installation properly so when executing your project with the Visual Studio Debugger the application is able to locate the required DLLs (without using windeploy.exe/QtDeploy setting).

Screenshots Project->Properties->Debugging->Environment (Default value) image

x.vcxproj.user (after adding a space before the default value): image

Desktop (please complete the following information):

Additional context First of all you can see in the screenshot that after %PATH% there is no semicolon (;) to divide the string inserted by $(LocalDebuggerEnvironment). Secondly after looking into the .vcxproj.user file after making a small change (like adding a space in front of the default value; the change is necessary so Visual Studio saves it in a file) it is visible that there is a newline after %PATH% which messes up the formatting. After looking into the QtMsBuild source, i have found that there actually is a newline (carriage return followed by line feed (
) inserted which maybe should be a semicolon ; to work properly. After replacing 
 with a semicolon in that file, everything seems to work properly and the Dlls are referenced correctly now. I am not sure if this is supposed to be a newline character for some reason, but as removing and replacing it with a semicolon fixes it, it seems like it should not be there.

Splixz00 commented 1 year ago

Seems like the issue is not the newline but a problem with Visual Studio adding mutliple semicolons to macros, resulting in a invalid PATH.