Installation Guide
This guide will walk you through setting up MvcCore Utilidades in your development environment.Prerequisites
- .NET 10.0 SDK - Download here
- Visual Studio 2022 (recommended) or Visual Studio Code with C# extension
- Git (optional, for cloning the repository)
Verify .NET Installation
Check .NET Version
Open your terminal and verify .NET 10.0 is installed:You should see version
10.0.x or higher.Project Setup
Restore NuGet Packages
Restore all required dependencies:This will install:
Microsoft.Extensions.Caching.Memory(v10.0.3)
Project Configuration
The project uses a minimal configuration approach. Here’s the.csproj file structure:
MvcCoreUtilidades.csproj
Key Configuration Points
Target Framework
Target Framework
The project targets .NET 10.0 (
net10.0) with nullable reference types enabled for better null safety.Static File Directories
Static File Directories
Three directories are pre-configured under
wwwroot/:images/- For uploaded imagesfacturas/- For invoice documentsuploads/- For general file uploads
NuGet Dependencies
NuGet Dependencies
Only one external package is required:
- Microsoft.Extensions.Caching.Memory (v10.0.3) - For in-memory caching
Application Startup Configuration
TheProgram.cs file configures all services and middleware. Here’s the complete setup:
Program.cs
Service Registration Explained
MVC Services
AddControllersWithViews() - Registers MVC services with Razor view support
Session Services
AddDistributedMemoryCache() + AddSession() - Enables session state management
Memory Cache
AddMemoryCache() - Registers IMemoryCache for in-memory caching
Custom Services
- HelperPathProvider (Singleton) - File path resolution
- RepositoryCoches (Transient) - Data access layer
Service Lifetimes:
- Singleton:
HelperPathProvider- Single instance shared across the application - Transient:
RepositoryCoches- New instance created for each request
Email Configuration (Optional)
If you plan to use the email functionality, configure SMTP settings inappsettings.json:
appsettings.json
Configure User Secrets (Recommended)
Running the Application
Access the Application
Open your browser and navigate to:orThe application will launch with the file upload page (default route:
UploadFiles/SubirFile).Troubleshooting
Port Already in Use
Port Already in Use
If ports 5000/5001 are occupied, modify
launchSettings.json or specify a different port:File Upload Errors
File Upload Errors
Ensure the
wwwroot directories have write permissions:Session Not Working
Session Not Working
Verify these two services are registered in And middleware is configured:
Program.cs:Email Sending Fails
Email Sending Fails
Common issues:
- Gmail: Enable “Less secure app access” or use App Passwords with 2FA
- Authentication: Ensure
UseDefaultCredentials = falseis set BEFORE setting credentials - Firewall: Check that outbound port 587 (or 465 for SSL) is open
Development Environment Setup
Visual Studio 2022
- Open
MvcCoreUtilidades.sln(if available) or open folder - Visual Studio will automatically restore NuGet packages
- Press F5 to run with debugging or Ctrl+F5 without debugging
Visual Studio Code
- Install the C# Dev Kit extension
- Open the project folder
- Press F5 to launch with debugger
- Or use integrated terminal:
Next Steps
Quick Start Guide
Now that you have the project set up, learn how to use the utilities with practical examples