← Back to dotnet/roslyn

How to Deploy & Use dotnet/roslyn

Roslyn .NET Compiler Platform - Deployment and Usage Guide

Prerequisites

  • Operating System: Windows, macOS, or Linux
  • .NET SDK: Version 6.0 or later (required for building and running)
  • Git: For cloning the repository
  • Development Tools:
    • Visual Studio 2022 (recommended for development)
    • Or Visual Studio Code with C# extension
  • Optional:
    • NuGet package manager for restoring dependencies
    • Azure DevOps account (for accessing pre-release builds)

Installation

  1. Clone the repository:

    git clone https://github.com/dotnet/roslyn.git
    cd roslyn
    
  2. Restore dependencies:

    dotnet restore
    
  3. Build the solution:

    dotnet build
    

Configuration

Environment Variables

  • No specific environment variables are required for basic usage
  • For development, ensure your system PATH includes the .NET SDK

NuGet Feeds (for pre-release builds)

Add these feeds to your NuGet configuration if you need access to pre-release builds:

Compiler feed:

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json

IDE Services feed:

https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json

.NET SDK feed:

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json

Build & Run

Development Build

# Build in Debug configuration
dotnet build -c Debug

# Build in Release configuration
dotnet build -c Release

Running Tests

# Run all tests
dotnet test

# Run specific test categories
dotnet test --filter "Category=Compiler"
dotnet test --filter "Category=IDE"

Running Compiler Tests

# Run compiler tests with specific configurations
dotnet test src/Compilers/CSharp/Test/CSharpCompilerCoreTests.csproj

Production Build

# Build in Release configuration with optimizations
dotnet build -c Release -p:Optimize=true

Deployment

Local Development

  • IDE Integration: Use Visual Studio 2022 or VS Code with Roslyn extensions
  • Command Line: Use csc.exe or dotnet build for compilation

NuGet Package Distribution

To create and publish NuGet packages:

  1. Create NuGet package:

    dotnet pack -c Release
    
  2. Publish to NuGet.org (requires API key):

    dotnet nuget push package-name.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
    

Azure DevOps Integration

For accessing pre-release builds:

  1. Add the appropriate NuGet feeds to your Azure DevOps project
  2. Use the package feeds in your project's NuGet configuration

Troubleshooting

Common Build Issues

Issue: Build fails with missing dependencies Solution: Ensure you've run dotnet restore and have the correct .NET SDK version installed

Issue: Tests fail on Windows vs Unix Solution: Check the CI status badges in the README for platform-specific issues

Issue: Cannot access pre-release NuGet feeds Solution: Verify your NuGet configuration and ensure you have proper authentication for Azure DevOps feeds

Debugging Tips

  1. Enable detailed logging:

    dotnet build -v detailed
    
  2. Use diagnostic tools:

    • Visual Studio Debugger
    • dotnet-trace for performance analysis
    • dotnet-dump for crash analysis

Performance Issues

Issue: Slow compilation times Solution:

  • Use Release configuration for production builds
  • Consider using incremental compilation
  • Check for large solution files that may impact build performance

API Usage Issues

Issue: Missing Roslyn APIs Solution:

  • Check the API review process documentation
  • Ensure you're using the correct version of the API
  • Consider contributing new APIs through the established review process

Community Support

For additional help: