Integrating AI capabilities into your applications is now easier than ever with .NET Aspire. Whether you’re experimenting with local AI models or deploying them to the cloud, Assemblysoft can guide your business in leveraging these advanced tools. By combining the flexibility of .NET Aspire with robust frameworks like Ollama, you can create innovative, AI-powered solutions tailored to your needs.

What .NET Aspire Gives You

Before the AI part, it is worth being clear about what Aspire itself brings to the table, because that is what makes the rest of this article so short. Aspire is an opinionated stack for building distributed .NET applications, and its centre of gravity is the AppHost project: a small C# program that describes your whole system — APIs, front ends, databases, caches, containers and, as below, AI models — as code.

  • Orchestration — press F5 and everything starts in the right order, with WaitFor expressing dependencies instead of wiki pages full of manual steps.
  • Service discovery and configurationWithReference flows connection strings and endpoints into each project automatically, so nothing sensitive is hard-coded and nothing drifts between environments.
  • The developer dashboard — every resource's console logs, structured logs, distributed traces and metrics in one browser tab, built on OpenTelemetry. For AI workloads this is gold: you can watch a prompt travel through your API into the model and back, with timings.
  • Integrations — NuGet packages that encapsulate the hosting and client wiring for dozens of services, from Postgres and Redis to, via the Community Toolkit, Ollama.

The result is that adding a capability to your system — including a running language model — is usually a couple of lines in the AppHost rather than a week of environment plumbing.

Using Local AI Models in .NET Aspire

Local AI models offer a convenient way to prototype and experiment without relying on cloud resources. By using Ollama’s integration with .NET Aspire, developers can:

  • Download and manage AI models locally.
  • Interact with models via a web interface for testing.
  • Transition seamlessly to cloud-hosted models when ready for deployment.

Here’s how Assemblysoft helps you get started:

Set up Ollama. Install the Ollama hosting integration from NuGet:

dotnet add package CommunityToolkit.Aspire.Hosting.Ollama

Configure it in Program.cs to enable local hosting:

var ollama =
    builder.AddOllama("ollama")
           .WithDataVolume()
           .WithOpenWebUI();

This setup ensures that models are downloaded and persisted, saving time on restarts and enabling easy interaction through a web UI.

Run AI models locally. Add your preferred model using the AddModel method:

var chat = ollama.AddModel("chat", "llama3.2");

You can also include models from the Hugging Face model hub for additional versatility.

A few practical notes from our own use: pick a model that fits your hardware — small models in the 1–8 billion parameter range run comfortably on a typical developer laptop, while larger ones want a serious GPU; the first run downloads several gigabytes, which is exactly why WithDataVolume() matters; and the bundled Open WebUI is the quickest way to sanity-check a model's behaviour before you write any application code against it.

Integrate models into your application. Link the AI models to your API project with minimal code:

builder.AddProject<Projects.MyApi>("api")
       .WithReference(chat)
       .WaitFor(chat);

This ensures your application waits until the model is fully downloaded and ready for use, enhancing stability and reliability.

Transitioning to Cloud-Hosted Models

While local models are excellent for development, cloud-hosted AI services like Azure OpenAI provide scalability and performance for production environments. With .NET Aspire’s abstractions, transitioning is seamless. Here’s how you can manage both local and cloud-hosted models:

if (builder.Environment.IsDevelopment())
{
    builder.AddKeyedOllamaSharpChatClient("chat");
}
else
{
    builder.AddKeyedAzureOpenAIClient("chat");
}

builder.Services.AddChatClient(b => b
    .UseFunctionInvocation()
    .UseOpenTelemetry(configure: t => t.EnableSensitiveData = true)
    .UseLogging()
    .Use(b.Services.GetRequiredKeyedService<IChatClient>("chat")));

This approach ensures your development and production environments use the most appropriate resources while maintaining consistent code.

Enhancing Applications with AI Integration

With Assemblysoft’s expertise, your business can:

  • Develop AI-driven APIs that leverage the latest in machine learning.
  • Utilise Microsoft.Extensions.AI abstractions for seamless transitions between local and cloud models.
  • Integrate AI capabilities into existing .NET Aspire solutions with minimal effort.

Where .NET Aspire Stands in 2026

This article was written in late 2024, when Aspire was still the new kid. Since then it has matured into the standard way to orchestrate cloud-native .NET development, and with .NET 10 now the current long-term support release it is our default starting point for any new distributed .NET system. The ecosystem has grown with it: the Community Toolkit integrations (including the Ollama one used above) have kept pace, and the dashboard and service-defaults experience have steadily improved with each release.

The AI side of the story has firmed up too. The Microsoft.Extensions.AI abstractions sketched in the code above — IChatClient, function invocation, telemetry middleware — have settled into the standard way .NET applications talk to language models, which means the local-Ollama-in-development, Azure-OpenAI-in-production pattern described here has aged well. Swapping providers remains a configuration decision rather than a rewrite, which as of 2026 — with models improving every few months — is worth more than ever.

Our recommendation is unchanged in direction and stronger in confidence: if you are building AI capabilities into a .NET system, let Aspire carry the orchestration and observability, keep your model access behind the abstractions, and prototype locally before you commit to cloud spend. If you would like help with any of that, see our AI software development and Azure development services.

Why Choose Assemblysoft?

At Assemblysoft, we specialise in empowering businesses to adopt cutting-edge technologies like AI and .NET Aspire. From setting up local AI models to deploying scalable cloud-based solutions, our team provides end-to-end support tailored to your goals.

Get Started Today

Whether you're exploring local AI models or preparing for cloud integration, Assemblysoft can help you navigate the complexities of modern AI development. Contact us today to learn how we can transform your applications with .NET Aspire and advanced AI tools!