Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Load A Qt Project To VS Solution That Has Custom Configurations
Forum Updated to NodeBB v4.3 + New Features

Load A Qt Project To VS Solution That Has Custom Configurations

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 2 Posters 469 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abhi_Varma
    wrote on last edited by
    #1

    Hi Community,

    I have Qt Visual Studio Solution that has multiple projects under it. The solution has 2 custom build configurations say customDebug and customRelease. I have a qt project that was created using qt creator and its default configurations are release and debug. I would like to add this project to my solution using the vs qt extension by selecting the pro file. On doing this its generating vcxproj and filter files for the new project. On trying to add the project using the gernerated vcxproj file. it says there is no information about the project with respect to the 2 custom build configurations.
    How can i resolve this?
    how can i create that custom configuration for the qt project?

    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
    • S SimonSchroeder

      @Abhi_Varma I am a huge fan of the command line tool sed to replace text in text files. There are package managers for Windows like Scoop (https://scoop.sh/) and Chocolatey (https://chocolatey.org/) which will help to easily install sed on Windows (I am using Scoop; it's just two lines on the PowerShell to install).

      Recently I used it to set the correct PlatformToolset and WindowsTargetPlatformVersion, as our previous approach was deleting the old solution, opening the generated vcxproj-file (freshly generated with qmake), and finally manually answering Visual Studio's question about upgrading to the most recent versions (if you don't delete the solution first, the question will not appear and you'll get some incompatibilities). Also, this now enables multiprocessor compilation by default. Just in case you want to go down that route, here are the sed commands we use (for some older qmake/Qt version):

      sed -i "s@<PlatformToolset>v120</PlatformToolset>@<PlatformToolset>v142</PlatformToolset>@" MyProject.vcxproj
      sed -i "s@<WindowsTargetPlatformVersion>10\.0\..*</WindowsTargetPlatformVersion>@<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>@" MyProject.vcxproj
      sed -i "s@^\(.*\)<WarningLevel>Level3</WarningLevel>@\1<WarningLevel>Level3</WarningLevel>\n\1<MultiProcessorCompilation>true</MultiProcessorCompilation>@" MyProject.vcxproj
      
      A Offline
      A Offline
      Abhi_Varma
      wrote on last edited by
      #5

      @SimonSchroeder This looks interesting, will find some time to try it. But what I have done is create a new project under my solution with the same name as the qt project. I configured it with all necessary setting. then i copied all the contents of the project into the folder of the newly created project and right clicked and added files to the project. Once the files are loaded under the project the settings are auto applied to each file.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonSchroeder
        wrote on last edited by
        #2

        First of all, from my experience using the VS plugin for Qt does not provide the best experience. We use qmake -tp vc MyProject.pro on the command line instead. In any case, the .vcxproj file is just an XML file. Try opening it with a text editor and change the build configuration from Release and Debug to customRelease and customDebug. This might be the quickest solution. You could also try to create a new build configuration as a copy of the existing Release/Debug configurations directly inside VS for this project.

        A 1 Reply Last reply
        0
        • S SimonSchroeder

          First of all, from my experience using the VS plugin for Qt does not provide the best experience. We use qmake -tp vc MyProject.pro on the command line instead. In any case, the .vcxproj file is just an XML file. Try opening it with a text editor and change the build configuration from Release and Debug to customRelease and customDebug. This might be the quickest solution. You could also try to create a new build configuration as a copy of the existing Release/Debug configurations directly inside VS for this project.

          A Offline
          A Offline
          Abhi_Varma
          wrote on last edited by
          #3

          @SimonSchroeder I am aware about editing the vcxproj file. The problem I'm trying to avoid is say my project has many files under it. If I edit the vcxproj file then I have add settings for each file for both customdebug and customrelease manually. I would like to avoid this laborious task. Hence looking for a better solution.

          S 1 Reply Last reply
          0
          • A Abhi_Varma

            @SimonSchroeder I am aware about editing the vcxproj file. The problem I'm trying to avoid is say my project has many files under it. If I edit the vcxproj file then I have add settings for each file for both customdebug and customrelease manually. I would like to avoid this laborious task. Hence looking for a better solution.

            S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #4

            @Abhi_Varma I am a huge fan of the command line tool sed to replace text in text files. There are package managers for Windows like Scoop (https://scoop.sh/) and Chocolatey (https://chocolatey.org/) which will help to easily install sed on Windows (I am using Scoop; it's just two lines on the PowerShell to install).

            Recently I used it to set the correct PlatformToolset and WindowsTargetPlatformVersion, as our previous approach was deleting the old solution, opening the generated vcxproj-file (freshly generated with qmake), and finally manually answering Visual Studio's question about upgrading to the most recent versions (if you don't delete the solution first, the question will not appear and you'll get some incompatibilities). Also, this now enables multiprocessor compilation by default. Just in case you want to go down that route, here are the sed commands we use (for some older qmake/Qt version):

            sed -i "s@<PlatformToolset>v120</PlatformToolset>@<PlatformToolset>v142</PlatformToolset>@" MyProject.vcxproj
            sed -i "s@<WindowsTargetPlatformVersion>10\.0\..*</WindowsTargetPlatformVersion>@<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>@" MyProject.vcxproj
            sed -i "s@^\(.*\)<WarningLevel>Level3</WarningLevel>@\1<WarningLevel>Level3</WarningLevel>\n\1<MultiProcessorCompilation>true</MultiProcessorCompilation>@" MyProject.vcxproj
            
            A 1 Reply Last reply
            0
            • S SimonSchroeder

              @Abhi_Varma I am a huge fan of the command line tool sed to replace text in text files. There are package managers for Windows like Scoop (https://scoop.sh/) and Chocolatey (https://chocolatey.org/) which will help to easily install sed on Windows (I am using Scoop; it's just two lines on the PowerShell to install).

              Recently I used it to set the correct PlatformToolset and WindowsTargetPlatformVersion, as our previous approach was deleting the old solution, opening the generated vcxproj-file (freshly generated with qmake), and finally manually answering Visual Studio's question about upgrading to the most recent versions (if you don't delete the solution first, the question will not appear and you'll get some incompatibilities). Also, this now enables multiprocessor compilation by default. Just in case you want to go down that route, here are the sed commands we use (for some older qmake/Qt version):

              sed -i "s@<PlatformToolset>v120</PlatformToolset>@<PlatformToolset>v142</PlatformToolset>@" MyProject.vcxproj
              sed -i "s@<WindowsTargetPlatformVersion>10\.0\..*</WindowsTargetPlatformVersion>@<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>@" MyProject.vcxproj
              sed -i "s@^\(.*\)<WarningLevel>Level3</WarningLevel>@\1<WarningLevel>Level3</WarningLevel>\n\1<MultiProcessorCompilation>true</MultiProcessorCompilation>@" MyProject.vcxproj
              
              A Offline
              A Offline
              Abhi_Varma
              wrote on last edited by
              #5

              @SimonSchroeder This looks interesting, will find some time to try it. But what I have done is create a new project under my solution with the same name as the qt project. I configured it with all necessary setting. then i copied all the contents of the project into the folder of the newly created project and right clicked and added files to the project. Once the files are loaded under the project the settings are auto applied to each file.

              1 Reply Last reply
              0
              • A Abhi_Varma has marked this topic as solved on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved