This is very strange. An MVC View refuses to recognize the System.Speech namespace. What’s the deal? And is there a work around for this? I have a ViewModel that has the VoiceAge and VoiceGender enum properties from this namespace, but the MVC view isn’t playing ball.
Repro
- Create a new MVC 3 project
- Add the “System.Speech” reference
- Try to navigate to the System.Speech namespace in the view
In the Controller it’s no problem:
using System.Speech.Synthesis;
using System.Web.Mvc;
namespace MvcApplication6.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
VoiceAge voiceAge = VoiceAge.Adult;
return View();
}
}
}
The View, not so much:

I’ve even added the namespace to the web.config, no luck:
<pages>
<namespaces>
<add namespace="System.Speech.Synthesis" />
Make sure that the
System.Speechassembly is present in the<assemblies>section of your web.config:Once it is added there make sure you recompile, close and re-open the .aspx view and then, normally, it should work.