I have a .NET 3.0 Winform Application with a corrupt user.config file causing system config errors.
I wanted to improve handle these errors, similar to how it's done in this example on CodeProject.
To use '
However, when I try and use the 'ConfigurationErrorsException' to get the name of corrupted file I receive the following error:
The type or namespace name 'ConfigurationErrorsException' could not be found (are you missing a using directive or an assembly reference?)
I have only seen this error previously where there were .NET framework conflicts.
The project has the target framework .NET 3.0. The ConfigurationErrorsException
was added in 2.0, so I didn't think there would be a framework conflict there.
The version 3.0 documentation is lacking compared to other versions and does say:
The current value is not one of the EnableSessionState values.
Which I'm not entirely sure what that implies (the documentation for EnableSessionState lead to more confusion rather than less).
- Why does the program fail to build, with a type or namespace missing error?
- Is this related to targeting .NET 3.0?
- If so, Is there an alternative for .NET 3.0?
EDIT: I have made sure to include 'using System.Configuration' at the top of my page. The total list of usings is:
using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Threading.Tasks;
using System.Configuration;
using System.Windows.Forms;
using System.Threading;
using ProjectName.Properties;
using System.Security.Permissions;
using Microsoft.Win32;