Develop a Visual Studio 2017 solution file that will enable a user to download a zip file of content (including a solution file), open the solution, hit run, and have the code Just Work (tm).
Python.net contains an example project that shows how to embed a Python interpreter into a C# project. However, this project doesn't work "out of the box" - it requires a bunch of configuration before it will work. It is part of a larger project, so you need to modify the solution file to set the starting project; then, when you do run it, you get errors because Python27.dll can't be found - which is problematic if you're trying to use Python 3.5.
I want to be able to give someone a zip file that contains the solution file and source code, have them open the file, run it, and get a useful executable.
The deliverable is the zip file, containing a Visual Studio 2017 solution file, the C# source code from the Python.net console demo, and any other support files necessary. I imagine this will include:
- A copy of Python. The zip file should contain the official embedded python zip file in a known location relative to the solution file. However, you cannot depend on a system installation of Python (or anything else other than Visual Studio).
- An installation of Python.net. Ideally, this will be in a directory other than the site-packages provided by the embedded Python install
When compiled, the executable should have a custom icon; any icon will do for sample purposes, but it should also be available in the zip file.
The ideal layout for the final zip file would be:
- Windows
- MyProject.sln
- MyProject.cs
- MyProject
- Resources
- myproject.ico
- Python
- (contents of embedded Python zip file)
- app_packages
- (installed version of python.net)
- app
- MyProject
- __init__.py
- app.py
- MyProject
- Resources
The solution file should output "MyProject.exe" in the MyProject directory.
For bonus points:
- The default source from the console demo of Python.net will require a command line argument; modify the sample code to invoke app.py with the contents of app and app_packages in the PYTHONPATH for the purposes of execution.
- The output app should be a gui app, not a console app. When MyProject.exe is executed, a black console window should not be displayed.
- Add a target to the solution file that produces an MSI installer with contents of the "MyProject" directory, including the executable, embedded python, app_packages and app.