I am trying to do a project that uses the windows speech recognition libraries and I 开发者_Python百科am trying to add a reference to System.speech since I am using:
SpeechSynthesizer synth = new SpeechSynthesizer();
However, I can't find System.speech in the .NET tab when I try to add a reference. I updated my .NET Framework and still can't find it. Is there a way to simply add it?
Check the reference assemblies directory typically found in : C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\
That should have a copy of System.Speech dll
Click on Project in the menu bar then click on Add Reference. Click on the .NET tab in the window that appears. Search and select System.Speech. Click OK. It should work after that.
Check your project type, and the version of the framework it's targeting.
SpeechSynthesizer
exists in .NET 3.0, 3.5 and 4 - but only in v4 of the client profile. If your project targets anything else, that would explain why you're not seeing it. Otherwise, it should be there though...
Well, I've experienced this problem many months ago. That's how the fix worked out for me: Go to: C:\ProgramFiles\Reference Assembly\Microsoft** Search for: **System.Speech.dll Add it as a Reference from Project|Add Reference menu.
This happens for the reasons:
- When you open project with first time and the reference to System.Speech not exist.
- When you open old project that build on older .NET version project with newer one this will happen.
Fine, it can be easily solvable:
Method 1
- Go to: Projects > Add reference > .NET Framework
- Select System.Speech
- Press OK
- Build Project once
If it doesn't solve this issue use method 2
Method 2
Add the following file to project.
Go to: Projects Menu > Add reference > Browse > C:\Program Files (x86)\Reference Assemblies\Microsoft.NETFramework\v4.6.1\System.Speech.dll
If it doesn't solve this issue use method 3
Method 3
Go to: Project Solution Explorer > Expand References > Right click on System.speech -> Select Properties -> Specific Version -> Set to "FALSE"
NOTE : make sure Embed Interop Types is set to "FALSE" (Reference Properties)
I also had the same issue, to solve it use projects
>add reference
,
then add the following file C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Speech.dll
精彩评论