Project Templates
CSnakes provides several project templates to help you get started quickly with different types of applications.
Available Templates
Console Application Template (pyapp)
Creates a simple console application with CSnakes integration.
What it creates:
- Basic console application
- Example Python file with type annotations
- Configured
.csprojfile - Simple C# code demonstrating Python function calls
Template Options
Common Options
All templates support these standard dotnet new options:
--name(-n) - The name for the output being created--output(-o) - Location to place the generated output--dry-run- Displays a summary of what would happen without creating files--force- Forces content to be generated even if it would change existing files--no-update-check- Disables checking for template package updates--project- The project that should be used for context evaluation--language(-lang) - Specifies the template language (C#)--type- Specifies the template type (project)
CSnakes Template-Specific Options
--PythonVersion(-P) - Python version to target (default: 3.12)- Available options:
3.9,3.10,3.11,3.12,3.13 --NoVirtualEnvironment(-N) - Disable virtual environment setup (default: false)- When false (default), a virtual environment will be created
--PackageManager(-Pa) - Package manager to use (default: none)- Available options:
none,pip,uv
Examples
Create a Named Project
Create with Specific Python Version
Create with Package Manager
Create Without Virtual Environment
Create with Multiple Options
Template Structure
Console App Template Structure
MyApp/
├── MyApp.csproj
├── Program.cs
├── python_modules/
│ ├── __init__.py
│ └── demo.py
└── requirements.txt
Customizing Templates
You can modify the generated templates by:
- Adding Python Dependencies: Edit
requirements.txt - Adding Python Modules: Create new
.pyfiles in the python_modules directory - Configuring Environment: Modify the Python environment setup in
Program.cs