We’ve had an extension for the lightweight VS Code IDE for quite some time, but now was as good a time as ever to create one for the full Visual Studio.
Tooling for PeachPie
Until now, we focused primarily on finishing the core of PeachPie, the PHP compiler and runtime for .NET & .NET Core. The objective was to make it usable in most common scenarios, and so performance optimizations and tooling had to wait. However, we now feel like the project is stable enough to provide developers with the necessary tools and services to work with it more comfortably.
A while ago, we published our extension for VS Code, which covers a majority of basic use cases, as well as debugging, diagnostics and error underlining. However, the full Visual Studio is a lot more powerful and offers plenty of options that make working with PeachPie even more efficient. The demand was there:
Release it to the VS Marketplace!!
— Mads Kristensen (@mkristensen) November 9, 2018
So we did it. And best of all: no more command line.
PeachPie in the full Visual Studio
While it was already possible to work with PeachPie in Visual Studio 2017, there was no official support or a managed extension that allowed you to work with PeachPie in Microsoft’s flagship IDE. We also had to implement a proper “SDK” for PeachPie compiler as a NuGet package.
As of today, however, you can install our official extension and enjoy all the benefits of compiling PHP to .NET within one of the world’s greatest IDE’s: Visual Studio.
Grab the extension [HERE]
Features
For now, we have added a few basic features that should be enough to get you off the ground. We will be improving our extension continuously, adding more features and templates and offering additional services around it. However, you can already work comfortable in Visual Studio and cover most use cases.
Project Templates
Hitting File | New Project gives you the option of easily creating a new PeachPie class library or console app:
No more command line and no more wondering how to configure your project file.
Manage the .NET Dependencies
Take advantage of Visual Studio’s comfortable management of project references and package dependencies:
The project system (which is based on Microsoft’s Common Project System (CPS)) now allows you to treat PHP code like any other .NET project. This includes the ability to reference DLLs, NuGet packages or other .NET projects (like C# or other PeachPie class libraries, …), and seamlessly use the contained classes and methods in your PHP code. Additionally, the PHP project itself can be “packed” into a NuGet package, and distributed source-lessly.
Visual Studio Diagnostic Tools
Microsoft’s Visual Studio provides a multitude of robust and powerful profiling tools:
This opens up a world of possibilities for PHP (PeachPie) applications. Profile your code for performance bottlenecks or memory leaks, monitor CPU usage, track exceptions and warnings and dive deep into individual pieces of code to see their effect on your application’s speed.
One-Click Azure Publish
Your C# application can be published on Microsoft Azure directly from Visual Studio. We personally like this feature and use it very frequently in combination with deployment slots. Now it is possible to publish the C# project including its PHP (PeachPie) project references.
Microsoft’s publish functionality packs the project, prepares the target server and uploads modified files within as a single task.
Debugging
The fact that the PHP project is compiled to .NET enables another mind-blowing feature – to debug the PHP (PeachPie) code on top of Microsoft’s .NET debugger, as if it were a regular .NET application.
The .NET debugger is precise and powerful, allowing you to add breakpoints and step through the code as you are used to from C#/F#/VB.
Grab the extension [HERE]