Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
In the modern landscape of software development, building and deploying distributed applications can be complex and challenging. Managing multiple services, dependencies, and deployment environments often requires significant effort and coordination. To address these challenges, Microsoft introduced Project Tye, a developer tool designed to simplify the development, testing, and deployment of .NET applications. In this article, we'll delve into the world of Tye, exploring its features, benefits, and practical applications for .NET developers. We will also learn about IronPDF, a PDF generation library from Iron Software, and use Tye and IronPDF in a practical example.
Tye is an open-source experimental developer tool that streamlines the process of building, testing, and deploying .NET project applications with minimal configuration. Developed by the Microsoft Engineering team, Tye aims to simplify the development workflow by providing a consistent, opinionated approach to managing microservices and their dependencies. At its core, Tye embraces the principles of containerization, orchestration, and developer productivity to enable seamless application development and deployment.
Tye automatically detects and manages dependencies between services within a .NET application. It leverages project metadata and Docker containers to infer service relationships, making it easier to coordinate communication and orchestration between microservices. This makes developing microservices easier with multiple projects.
Tye integrates seamlessly with Visual Studio and Visual Studio Code, providing a familiar development environment for .NET developers. It offers tools for debugging, logging, and monitoring application components, enabling rapid iteration and troubleshooting during development.
Tye embraces Docker containers as the unit of deployment for .NET applications. It automatically generates Dockerfiles for each service based on project configurations, facilitating consistent and reproducible container builds across development and production environments, making testing and deploying microservices easy.
Tye simplifies local development by orchestrating dependencies and services within a single environment. Developers can spin up the entire application stack with a single command, eliminating the need for manual setup and configuration of dependencies.
Tye provides built-in support for deploying .NET applications to Kubernetes clusters. It generates Kubernetes manifests and Helm charts based on project specifications, streamlining the deployment process and promoting best practices for container orchestration in cloud-native environments.
Tye integrates with popular observability tools such as Prometheus and Grafana to provide insights into application performance and health. It exposes metrics and logs from application components, enabling developers to monitor resource utilization, identify bottlenecks, and diagnose issues in real-time.
Let's explore some practical scenarios where Tye can streamline .NET application development and deployment:
# Start Tye in local development mode with tye run command
tye run
# Start Tye in local development mode with tye run command
tye run
IRON VB CONVERTER ERROR developers@ironsoftware.com
Build Docker images for Tye services with available solution file
tye build
Build Docker images for Tye services with available solution file
tye build
IRON VB CONVERTER ERROR developers@ironsoftware.com
Deploy Tye application to Kubernetes cluster
tye deploy --interactive // deploy microservices and distributed applications
Deploy Tye application to Kubernetes cluster
tye deploy --interactive // deploy microservices and distributed applications
IRON VB CONVERTER ERROR developers@ironsoftware.com
To get started with Tye:
Install .NET Core 3.1 (not supported for higher version) on your machine.
dotnet tool install -g Microsoft.Tye --version "0.2.0-alpha.20258.3"
dotnet tool install -g Microsoft.Tye --version "0.2.0-alpha.20258.3"
IRON VB CONVERTER ERROR developers@ironsoftware.com
Create a new folder for your microservices.
mkdir microservices
cd microservices
dotnet new razor -n frontend // frontend service or backend service
mkdir microservices
cd microservices
dotnet new razor -n frontend // frontend service or backend service
IRON VB CONVERTER ERROR developers@ironsoftware.com
tye run frontend // frontend project or backend project
tye run frontend // frontend project or backend project
IRON VB CONVERTER ERROR developers@ironsoftware.com
This will build, run, and monitor the frontend application. You can access the Tye dashboard at http://localhost:8000 to view the state of your services
Tye has an optional configuration file, tye.yaml, that allows for customization of settings. This YAML file includes all of your projects and external dependencies. If you have an existing solution, Tye will automatically populate it with all of your current projects.
To initialize this YAML file, navigate to the microservices directory and run the following command to generate a default tye.yaml file:
tye init
tye init
IRON VB CONVERTER ERROR developers@ironsoftware.com
A tye.yaml file is created as shown below
name: myawesomeapplication
services:
- name: backendtest
project: backend/backend.csproj
bindings:
- port: 7000
- name: frontendtest
project: frontend/frontend.csproj
replicas: 2
bindings:
- port: 8000
- name: workertest
project: worker/worker.csproj
- name: rabbit
image: rabbitmq:3-management
bindings:
- port: 5672
protocol: rabbitmq
Project Tye comes with MIT License which is free for use for development and commercial purposes.
IronPDF is a powerful C# library designed for creating, editing, and signing PDFs from HTML, CSS, images, and JavaScript. It offers commercial-grade performance with a low memory footprint.
Convert HTML files, HTML strings, and URLs to PDFs. For example, render a webpage as a PDF using the Chrome PDF renderer.
Compatible with various .NET platforms, including .NET Core, .NET Standard, and .NET Framework. It supports Windows, Linux, and macOS.
Set properties, add security with passwords and permissions, and apply digital signatures to your PDFs.
Customize PDFs with headers, footers, page numbers, and adjustable margins. Supports responsive layouts and custom paper sizes.
Adheres to PDF standards such as PDF/A and PDF/UA. Supports UTF-8 character encoding and handles assets like images, CSS, and fonts.
Now let us see a practice example with these two libraries.
First, let's create a Visual Studio Razor application. Open Visual Studio and create a new project and select the razor app as shown below.
Provide the project name and location.
In the next step, select the .NET Framework version and click on Create. Since Tye works only on .NET 3.1, we will select the same.
Install IronPDF from NuGet Package from Visual Studio Package Manager.
Next, open the File Browser and navigate to the solution folder. Then open the CMD prompt.
Install Tye using the following command:
dotnet tool install -g Microsoft.Tye --version "0.11.0-alpha.22111.1"
dotnet tool install -g Microsoft.Tye --version "0.11.0-alpha.22111.1"
IRON VB CONVERTER ERROR developers@ironsoftware.com
OR if you already have Tye installed and want to update it use the below command:
dotnet tool update -g Microsoft.Tye --version "0.11.0-alpha.22111.1"
dotnet tool update -g Microsoft.Tye --version "0.11.0-alpha.22111.1"
IRON VB CONVERTER ERROR developers@ironsoftware.com
Initialize Tye using the following command:
tye init
tye init
IRON VB CONVERTER ERROR developers@ironsoftware.com
This will create a template YAML file as below:
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
#
# when you've given us a try, we'd love to know what you think:
# https://aka.ms/AA7q20u
#
# define global settings here
# name: exampleapp # application name
# registry: exampleuser # dockerhub username or container registry hostname
# define multiple services here
services:
- name: frontend
project: Frontend\Frontend.csproj # msbuild project path (relative to this file)
# executable: app.exe # path to an executable (relative to this file)
args: -f=netcoreapp3.1 # arguments to pass to the process
# replicas: 5 # number of times to launch the application
# env: # array of environment variables
# - name: key
# value: value
# bindings: # optional array of bindings (ports, connection strings)
# - port: 8080 # number port of the binding
Run Tye with the following command:
tye run frontend
tye run frontend
IRON VB CONVERTER ERROR developers@ironsoftware.com
This will open the Tye dashboard at URL: http://127.0.0.1:8000/
to see the app running.
Next, add the below code to the project to generate a PDF document from any website URL with a click of a button.
Add the below code to the Index.cshtml file:
@page
@model IndexModel
@{
ViewData["Title"] = "Generate PDF";
}
<form method="post" class="text-center flex-row">
<h1 class="display-4">Welcome To Url To PDF Generator </h1>
<p>Enter Website Url:
<button type="submit">Generate PDF</button>
@if (Model.Message != null)
{
<p>@Model.Message</p>
}
</form>
@page
@model IndexModel
@{
ViewData["Title"] = "Generate PDF";
}
<form method="post" class="text-center flex-row">
<h1 class="display-4">Welcome To Url To PDF Generator </h1>
<p>Enter Website Url:
<button type="submit">Generate PDF</button>
@if (Model.Message != null)
{
<p>@Model.Message</p>
}
</form>
IRON VB CONVERTER ERROR developers@ironsoftware.com
Then add the below code to Index.cshtml.cs:
using IronPdf;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Frontend.Pages
{
public class IndexModel : PageModel
{
public string Message { get; set; }
[BindProperty]
public string UrlInput { get; set; }
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
public IActionResult OnPost()
{
if (string.IsNullOrEmpty(UrlInput))
{
ModelState.AddModelError("UrlInput", "Please enter some text.");
return Page();
}
// Create PDF from ChromePdfRenderer
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf(UrlInput);
// Return the PDF as a file result
var pdfBytes = pdf.BinaryData;
return File(pdfBytes, "application/pdf", "GeneratedDocument.pdf");
}
}
}
using IronPdf;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Frontend.Pages
{
public class IndexModel : PageModel
{
public string Message { get; set; }
[BindProperty]
public string UrlInput { get; set; }
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
public IActionResult OnPost()
{
if (string.IsNullOrEmpty(UrlInput))
{
ModelState.AddModelError("UrlInput", "Please enter some text.");
return Page();
}
// Create PDF from ChromePdfRenderer
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf(UrlInput);
// Return the PDF as a file result
var pdfBytes = pdf.BinaryData;
return File(pdfBytes, "application/pdf", "GeneratedDocument.pdf");
}
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Now run Tye as below:
This will launch the Tye dashboard.
Now click on any of the links in the bindings section to open the PDF generator app and enter a sample URL for PDF generation.
Click the generate button to get the following PDF as output:
Code Explanation
Visit IronPDF Licensing page.
Place the License Key in the appSettings.json file as shown below:
{
"IronPdf.License.LicenseKey" : "The Key Here"
}
In conclusion, Tye represents a significant advancement in the .NET ecosystem, offering a streamlined approach to building, testing, and deploying distributed applications. Whether you're a seasoned .NET developer or new to containerization and microservices, Tye provides a user-friendly platform for embracing modern development practices and accelerating your journey toward cloud-native architecture.
IronPDF is a .NET library that allows developers to create, manipulate, and render PDF documents from HTML content easily. It supports converting HTML to PDF, merging and splitting PDFs, and adding headers, footers, and watermarks. IronPDF is known for its ease of use, high-quality rendering, and compatibility with .NET Core and .NET Framework applications. Knowing both the IronPDF library and the Tye build tool, developers can gain advanced skills to develop modern applications with PDF generation capabilities.
9 .NET API products for your office documents