System.Speech not working on deployment

Copper Contributor

I am using .NET 6 and have installed the System.Speech NuGet package. I am using the System.Speech.Synthesis library. It works fine within the Visual Studio IDE (compiled for Debug and Release) but as soon as I created an installer using the Microsoft Setup extension and install the program on exactly the same machine as running the IDE, I get an Exception: -

 

System.PlatformNotSupportedException: Speech is not supported on this platform.

 

Under the IDE, everything works fine - no crashes and I can hear the speech. Stand-alone the application causes an exception on creating an instance of the System.Speech.Synthesis.SpeechSynthesizer object.

 

Because it works fine under the IDE, I can't use it to do any pinpointing of the problem.

 

I have repeated this on three totally different computers all with the same results. It does not appear to be a configuration issue with one machine.

3 Replies
That is not true. C# runs on the server. JavaScript and HTML run in the user's browser. The library you are using is C# running on the server, so the sound would play on the server. It works on your local machine because it is the client and server during development. There is no workaround; find a library that does what you need with JavaScript on the client, maybe?
https://thabani.co.za/uk49s-results-today/

@neo232 , it's a desktop application. No server. No Javascript. 100% C# running on a single computer. Like I said, works via IDE but throws an exception when installed.

Hi @BrianGCampbell,

Thanks for posting your issue here.

However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang