0

I'm working on a project with Qt using the Visual Studio Addin in VS2010 Professional. Two branches of the project use two different Qt versions (4.8.4 and 5.0.2) so I have both versions of the addin installed (1.1.11 and 1.2.1). I'm also actively developing using at least two computers, both Windows 7, for which I have a networked, roaming user profile. I don't know the specifics of how this user account or network is setup.

Qt is installed in different locations on each system. If I set the correct paths in the Addin on one system (System A), it changes them for the other system (System B) and then complains to me that Qt doesn't exist at that directory when I later log into System B. Is there a way to save the paths to Qt versions on the system, without it affecting the paths on the other system? Or will I have to just deal with changing them each time I change computers?

EDIT:

I from looking through the source for the visual studio add-in, I found that these settings are saved as user registry values. I don't know much about Windows roaming profiles but I'm now assuming that user registry values are copied between computers just as their files are. I don't know if there's any way to move these registry values somewhere else without having to edit and recompile the add-in. I suppose the only other thing I could do is write a startup script to edit these settings upon login.

may5694
  • 133
  • 1
  • 6

1 Answers1

1

EDIT: Make sure visual studio on each computer can find the right add-in and the right environment variables on the computer you are using.

http://qt-project.org/wiki/QtVSAddin

In this documentation it talks about where it gets installed to:

"%USERPROFILE%\Documents\Visual Studio 2008\Addins"

So you could manually change the location of the addin, to some local system path.

How to -> Visual Studio Add In Manager

Or you could change the qt path that the Add-in refers to every time you log in, or right before opening visual studio.

Setting a system environment variable from a Windows batch file?

I would use version control to just get the files that you need for the project, and exclude/ignore all the environment specific elements of the project.

One way you could achieve this is:

To install Bazaar. Create a standalone tree of the code on a shared drive or on a location on the harddrive that both users have access to.

Do an initial add of all your source and header files and your qt .pro file.

Checkout or branch the code to user specific folders. In those user specific folders, let Visual Studio create all the user specific, Qt Add-on specific, (etc) files.

Also create a .bzrignore file with files and folders like these listed:

Debug
Release
x64
*.ncb
*.suo
*.user
*.vssscc
*.scc
*.vspscc
*.lnk
*.bak
*.aps
*.pro.user
object_script.*
Makefile
Makefile.Release
Makefile.Debug

Then when you want to try your build for each setup, finish your edits, commit/push your changes on the user that did the edits, and update/pull on the user that wants the changes.

Although the version control may be a little tricky to get started with, it will make project collaboration both scalable, trackable, and very manageable!

And you aren't limited to Bazaar. Check this wiki out if you need ideas.

http://en.wikipedia.org/wiki/Comparison_of_revision_control_software

Another way that you could try to go about doing this, is to have all the source code in some path (either absolute or relatively up from your projects locations), or on the computer, and have the project folders reference those paths in the project folders, but have two separate project folders. This would not be nearly as elegant, but would work.

C:/path/to/vs_proj1
C:/path/to/vs_proj2
C:/path/other/proj/source

And in the properties for vs_proj1, and vs_proj2, in the part about locating source files, have ../other/proj/source to find it relatively, or put the absolute path C:/path/other/proj/source.

Also two other things to be aware of when sharing projects over a drive like this, is that when you are referencing libraries, you may want to store that information in a user specific macro file in Visual Studio and reference the macro in your project settings.

Visual Studio - Where to define custom path macros?

And while I'm here, you may need to #define some things in your program to allow for behavior for one version of Qt that isn't in the other.

So for example, in the source of your program, you might have:

#if QT_VERSION < 0x050000
// some Qt 4.x specific stuff, not in Qt 5
#else
// some Qt 5 specific stuff, not in Qt 4.x
#endif

Hope that helps.

Community
  • 1
  • 1
phyatt
  • 18,472
  • 5
  • 61
  • 80
  • Thanks for your response, but I'm already using version control (Git, specifically). But unfortunately that does not solve the issue. In fact, the add-in settings aren't even related to this specific project; it complains about the directories when I open VS2010, before loading my project. – may5694 May 31 '13 at 18:18
  • I didn't understand the issue at hand before as well. Hopefully my edits are useful. Good luck. – phyatt May 31 '13 at 19:09
  • I looked into changing the location of the add-in, but it told me it was stored locally, not in my roaming profile. I also tried forcing visual studio to save my settings on the local drive instead of on my profile, but that didn't work either. I tried searching both my profile and the local drive to find where the add-in stores its settings, but I could not find anything, not even by Googling it. – may5694 May 31 '13 at 20:34
  • Just digging through my registry I found the following: HKEY_CURRENT_USER\Software\Trolltech\Versions\DefaultQtVersion and HKEY_CURRENT_USER\Software\Trolltech\Qt4VS2008 I think these are both used by the add-in. You could try checking what these values are on your computer to see if they are the source of the issue. – phyatt May 31 '13 at 21:09
  • I bet that version information in the registry is read on startup of the Add-In. – phyatt May 31 '13 at 21:49