Getting Started with Viana.NET: A Beginner’s GuideViana.NET is a modern framework designed to simplify building, testing, and deploying .NET applications with a focus on developer productivity and modular architecture. This guide walks a beginner through what Viana.NET is, why you might choose it, how to set up your environment, create your first project, and adopt best practices for development and deployment.
What is Viana.NET?
Viana.NET is a framework and toolkit that extends the .NET ecosystem by providing opinionated patterns, reusable components, and utilities to accelerate common tasks in application development — such as project scaffolding, dependency injection setup, modular services, configuration management, and standardized testing patterns. It aims to reduce boilerplate while keeping flexibility for advanced scenarios.
Key benefits at a glance:
- Rapid project scaffolding
- Built-in modular architecture
- Opinionated conventions for configuration and DI
- Tools for testing and deployment
When to choose Viana.NET
Choose Viana.NET if you:
- Want a structured, modular approach to organizing .NET projects.
- Prefer convention-over-configuration to reduce setup time.
- Need integrated tools for testing and deployment.
- Are building medium-to-large applications where maintainability and modularization matter.
You might prefer plain .NET or other frameworks if you need extremely lightweight setups, have very specific architectural constraints, or depend on third-party libraries incompatible with Viana.NET conventions.
Prerequisites
Before you begin, ensure you have:
- .NET SDK (recommended version: use the latest LTS; check compatibility with Viana.NET)
- A code editor — Visual Studio, Visual Studio Code, or JetBrains Rider
- Basic knowledge of C# and .NET concepts (projects, NuGet, DI)
- Git (for version control and scaffolding templates)
Installing Viana.NET tools
- Install the .NET SDK from the official Microsoft site if you don’t have it.
- Install any Viana.NET global tools or templates (example command — replace with actual package name if different):
dotnet new -i Viana.NET.Templates dotnet tool install -g Viana.NET.Cli
- Verify installation:
dotnet viana --version
Creating your first Viana.NET project
- Scaffold a new project using the Viana template:
dotnet new viana-app -n MyVianaApp cd MyVianaApp
- Explore the generated structure — common folders you’ll see:
- src/ — application projects
- tests/ — unit and integration tests
- modules/ — feature modules
- docs/ — documentation/stories
- build/ — CI/CD scripts and pipelines
- Restore and run:
dotnet restore dotnet run --project src/MyVianaApp.Api
You should see the application start with a default home route and health endpoint.
Project structure and conventions
Viana.NET emphasizes modularity. Typical conventions:
- Each feature lives in its own module under modules/, containing the module’s API, services, DTOs, and tests.
- Shared libraries (cross-cutting concerns) under src/Shared.
- Configuration via strongly-typed settings objects mapped from appsettings.json and environment variables.
- Dependency injection configured per-module with extension methods like AddMyModuleServices.
Example module registration in Startup/Program:
builder.Services.AddMyFeatureModule(Configuration);
Dependency Injection and configuration
Viana.NET encourages:
- Constructor injection for services.
- Small, focused service interfaces.
- Scoped/lifetime choices aligned with ASP.NET Core conventions.
- Strongly-typed configuration:
builder.Services.Configure<MySettings>(Configuration.GetSection("MySettings"));
Access settings via IOptions
or IOptionsSnapshot .
Building features and modules
- Create a module folder under modules/MyFeature.
- Add a class library project and reference shared packages:
dotnet new classlib -n MyFeature dotnet add src/MyVianaApp.Api reference modules/MyFeature/MyFeature.csproj
- Implement services, controllers, and a Module registration extension:
public static class MyFeatureServiceCollectionExtensions { public static IServiceCollection AddMyFeature(this IServiceCollection services, IConfiguration config) { services.AddScoped<IMyService, MyService>(); // other registrations return services; } }
- Register in the API project.
Testing strategy
Viana.NET promotes isolation and modular tests:
- Unit tests per module in tests/ModuleName.UnitTests.
- Integration tests using in-memory hosts or test containers in tests/ModuleName.IntegrationTests.
- Use xUnit or NUnit and FluentAssertions for expressive assertions.
Example test command:
dotnet test
Local development workflow
- Use hot-reload (dotnet watch) for faster iteration:
dotnet watch run --project src/MyVianaApp.Api
- Leverage Swagger/OpenAPI generated by default for API exploration.
- Use Postman or HTTPie for manual testing:
http GET http://localhost:5000/health
CI/CD and deployment
- Viana.NET templates often include GitHub Actions or Azure DevOps pipeline snippets.
- Build steps: restore, build, test, publish.
- Deploy to containers or serverless hosts. Example GitHub Actions job (simplified): “`yaml jobs: build: runs-on: ubuntu-latest steps:
- uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: dotnet-version: 8.x - run: dotnet restore - run: dotnet build --no-restore --configuration Release - run: dotnet test --no-build --verbosity normal - run: dotnet publish src/MyVianaApp.Api -c Release -o publish
”`
Best practices
- Keep modules small and cohesive.
- Prefer composition over inheritance for services.
- Keep configuration centralized and environment-specific settings out of source control.
- Write tests alongside feature development.
- Use versioned APIs and feature toggles for backward compatibility.
Troubleshooting common issues
- Build fails after template update — run dotnet restore and update NuGet packages.
- Port conflicts — change launchSettings or environment variables.
- DI errors — ensure services are registered before use; check lifetimes.
Next steps and learning resources
- Explore the generated modules and tests in your scaffolded project.
- Read the Viana.NET docs (local docs/ or online) for advanced topics: multi-tenancy, observability, and performance tuning.
- Contribute to community templates or create custom module templates.
Viana.NET reduces boilerplate and enforces clean modular patterns that help teams scale projects. Start small — scaffold a sample app, add one module, write tests, and extend from there.
Leave a Reply