0

I have a few questions:

  1. Is there any way through which I could create a Visual Studio Project, add files to it, and build it from within a Python program?

  2. Are there built-in commands to do this? If not any commands which could be run in command line?

Thanks for the help.

Jason
  • 2,278
  • 2
  • 17
  • 25
Pranav
  • 115
  • 1
  • 11
  • does it need to be Visual Studio? MS have released VS Code, which is a tremendous scripting IDE. http://code.visualstudio.com – wazdev Mar 08 '16 at 04:30
  • This youtube video shows you how to build python apps in VS Code: https://www.youtube.com/watch?v=doSPnFks5Vk – wazdev Mar 08 '16 at 04:40
  • Possible duplicate of [Call Python function from c# (.NET)](http://stackoverflow.com/questions/35462175/call-python-function-from-c-sharp-net) – Morganis Mar 11 '16 at 09:19
  • Possible duplicate of http://stackoverflow.com/questions/35848305/running-several-python-scripts-from-c-sharp/35897687#35897687 – Morganis Mar 11 '16 at 09:19

2 Answers2

1

is there any way through which I could create a Visual Studio Project, add files to it

Whilst there is a .NET API for creating/manipulating project files, it's a bit on the undocumented side (I have used it in the past though) and I don't know if you can call it from Python. If you want to see the .NET API just look at the IronPython Custom Project Extension project.

However, VS project files are just XML files so if you know the schema, you can just write to the files from Python using your API of choice. VS won't know any better.

and build it from within the python program

Ultimately you can just spawn a process to invoke msbuild. Works for Jenkins.

0

Recently it looks like Microsoft has released Python tools for Visual Studio found here.

There is an Iron Python NuGet package that is tightly integrated with .NET, but not sure you'd want to use this for pure Python programming. I would also recommend Jetbrain's PyCharm which is an IDE also suited for Python or just use Notepad++ (free) and compile from the command line.

Jason
  • 2,278
  • 2
  • 17
  • 25
mike gold
  • 1,551
  • 12
  • 12