1

Closed

Loading Python project from macro command

description

I'm trying to add my python project in my solution file (C++ projects & Fortran projects) using Visual Studio macros, but it seems that the python project can not be added this way. What I'm trying to do is to invoke the following command whenever I'm loading my solution :
DTE.ExecuteCommand("File.AddExistingProject", "my_python_proj.pyproj")
which is the command dumped in macro record by Visual Studio when I'm doing the import with the GUI.
The problem is that when executing this command Visual Studio is displaying a message box with an error : The project can not be converted, please see details in conversion log.

Maybe there is no support for using VS API in PTVS ? (I'm running 1.5 RC)

(The reason I'm trying to do this is that I use a build system which automatically generates SLN files, vcxproj's, vfproj's and I don't really want to modify it to write also pyproj files. So whenever I'm regenerating my build system I have to import the pyproj file in the created sln file which is a bit annoying).

Thanks,
Closed Mar 13 at 5:51 PM by dinov

comments

Zooba wrote Feb 20 at 4:09 PM

We should support that API, since it should just be using the same code as when you manually add a project. The failed conversion is more interesting, since we don't (yet) support any project upgrades.

Can you attach the details from the conversion log? I'm interested to know what sort of conversion is being attempted here. If I recall correctly, VS 2010 only ever upgrades C++ projects, though VS 2012 also has upgrades for other languages.

Also, we released 1.5 final, so you may want to update to that in case we fixed a bug that might have caused this.

bde_fft wrote Mar 6 at 9:26 AM

Sorry for the late answer, I was out of office for a week.

I did not give you all the informations, sorry. I'm running Visual Studio 2010 and PTVS 1.5 final (not RC).

Anyway, I think it was a problem in my macro (handling of path to python project - trying to reach the project from current path "../test/myproject") because if I'm hardcoding it it seems to work fine. So there is no bug here, this ticket can be rejected (sorry).

Thank you and keep up the good work, PTVS is really a must-have extension for VS python developpers !

Zooba wrote Mar 6 at 3:49 PM

Thanks for the clarification. I assume you have similar code for other project types though, so if they support loading from a relative path then we really should too.

Are you sure this was just a problem in your macro?

bde_fft wrote Mar 13 at 3:45 PM

Hy,

This was clearly a problem in my macro. I managed to make it work using relative path to my python project.
Sorry, I probably should have posted in Discussions section before opening a ticket.

Best Regards