ahesa
ahesa

Reputation: 274

Setting an environment variable for the performance analyzer in visual studio 2013

I am currently trying to use the performance analyzer for my projects in Visual Studio 2013 (C++). The project runs in debug and release mode in Visual Studio with the Configuration Properties -> debugging -> Environment set to PATH=$(MYPATH);%path.

I use this to allow Visual Studio to find all the dlls I need which are scattered in different directories (for instance the boost dlls are all in one place on my computer).

For some reason, it does not work when using the Performance Wizard. I used the recommended CPU sampling and made sure my app could start on F5. When started from the performance wizard it says :

"The program can't start because mydll.dll is missing from your computer..."

I suspect the problem is with the environment variable the profiler uses on start. Is there anyway to tell the profiler to use a specific environment variable ?

I have searched for a while but I have not found any information on how to do that. Maybe I am not using the proper keywords ? I have read these but they do not really help :

**To be noted : if I copy the missing dlls in my .exe folder it works fine. This solution requires a lot of copying and I would rather avoid it if possible.

Upvotes: 7

Views: 1415

Answers (2)

Valentyn Vovk
Valentyn Vovk

Reputation: 117

I created .bat file near .sln file with the following content:

set PATH=$(MYPATH);%PATH%

your_solution.sln

And it works for me

Upvotes: 0

ahesa
ahesa

Reputation: 274

After some more research I finally found this: https://connect.microsoft.com/VisualStudio/feedback/details/981900/profiler-does-not-respect-debugging-environment-variables-for-project

It seems it is a known issue and Microsoft won't be fixing it.

It seems my only choice is a copy script as a pre-build step. If anyone has a better solution, I'd still be interested to hear it!

Upvotes: 4

Related Questions