Updating DSS for C# 7.3 Support


Prerequisites:

Ensure you have the following before starting the DSS C# 7.3 upgrade process:

  • Permissions: System administrator permissions to the DSS server.
  • Current CMS Version: CMS 10.6.378 or below that requires upgrade to CMS 10.6.492 with C# 7.3 support.
  • Development Environment: Microsoft Visual Studio with NuGet Package Manager.
  • Backup: Complete backup of your DSS project files.
    Warning
    Always work with a backup copy. Never perform configuration changes directly on production code without proper version control and testing procedures.

The DSS project has been updated to support C# 7.3 for CMS 10.6.492. When upgrading the DSS site instance and DSS Preview, this breaking change requires updating your project to include the Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1 reference and updating Web.config compiler settings.

This update enables modern C# language features and improved compilation performance. The changes affect project dependencies, compiler configuration, and assembly binding redirects.

Steps include:

  1. Update Project References
  2. Update Web.config Compiler Settings
  3. Add Assembly Binding Redirect
  4. Verify DSS Build

Update Project References

Add the Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1 reference to your DSS project files to support C# 7.3 compilation.

To update DSS project references:
  1. Open your DSS project in Microsoft Visual Studio then verify the reference to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0 is included in your project files.

    Ensure the reference is merged into both:

    • DSS .csproj file
    • DSS packages.config file
  2. If the reference is missing, add it using NuGet Package Manager:
    1. Click Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
    2. Search for Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
    3. Install version 4.1.0 for your DSS project.
  3. Keep the DSS project open in Visual Studio for next steps.

Update Web.config Compiler Settings

Replace the legacy compiler settings in Web.config with the new Microsoft.CodeDom.Providers.DotNetCompilerPlatform compiler configuration to enable C# 7.3 support.

To update Web.config compiler settings:
  1. Navigate to Solution Explorer in Visual Studio and expand the solution and open Web.config.
  2. Locate and remove the legacy C# compiler configuration then replace it with the new configuration:

    To remove:

    Legacy C# compiler setting to remove
    <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    To add:

    New C# compiler setting
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:latest /nowarn:1659;1699;1701" />
  3. Locate and remove the legacy VB.NET compiler configuration:

    To remove:

    Legacy VB.NET compiler setting to remove
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/d:Trace=true" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    To add:

    New VB.NET compiler setting
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:latest /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
  4. Add the additional VB.NET compiler configuration if not present:
    Additional VB.NET compiler setting
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/d:Trace=true" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  5. Save Web.config and keep the file open in Visual Studio for next steps.

Add Assembly Binding Redirect

Add the required assembly binding redirect for Microsoft.CodeDom.Providers.DotNetCompilerPlatform to ensure proper version resolution.

To add assembly binding redirect:
  1. Locate the <runtime> code in the DSS Web.config file.
  2. Add the following assembly reference within the <assemblyBinding> element:
    Assembly binding redirect for Microsoft.CodeDom.Providers.DotNetCompilerPlatform
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
    </dependentAssembly>
  3. Save and close Web.config, and keep the DSS project open for next steps.

Rebuild DSS Solution

Build and test your DSS project to verify the C# 7.3 support changes have been successfully implemented.

To verify DSS build with C# 7.3 support:
  1. Open Solution Explorer in Visual Studio.
  2. Right-click the DSS solution and select Rebuild.
  3. Verify the solution rebuilds without errors.

The DSS project rebuilds without errors or warnings. The project now supports C# 7.3 with the updated Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1 reference and compiler configuration.

Task Troubleshooting: If build errors occur after implementing the C# 7.3 changes:

  • Verify package installation: Ensure Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1.0 is properly installed via NuGet Package Manager.
  • Review Web.config syntax: Verify all elements are properly closed and formatted in the Web.config file.
  • Review assembly binding: Confirm the assembly binding redirect is correctly placed within the <runtime>/<assemblyBinding> element.
  • Clean and rebuild: Clean the solution followed by a full rebuild to resolve any cached compilation issues.
Additional resources:

Test DSS Functionality

Test DSS functionality to ensure the upgrade does not affect existing features.

Include these tasks in your testing strategy:

  • Run the solution locally using Visual Studio, or deploy to a staging DSS or DSS Preview site.
  • Confirm pages load correctly.
  • Test all custom functionality thoroughly.

Review Ingeniux CMS 10.5–10.6 DSS Upgrade Checklist for standard DSS upgrade verification tests.

Task Troubleshooting: If the DSS fails to run after upgrade:

  1. Check Configuration: Verify all configuration settings.
  2. Review Logs: Analyze application logs for error messages.
  3. Test Incrementally: Temporarily disable custom functionality to isolate issues.