Visual Studio 2012 failed to create project

2019-01-27 19:47发布

问题:

I just upgraded to windows 8 from windows 7. Visual studio 2010 broke down completely. Oh well. I removed vs2012 and installed visual studio 2012, where the pain starts. I have been reinstalling vs 2012 a couple of times. However, the symptom remains the same. When I try to create a new project (FILE -> New -> Project or ctrl + N).
It pops up with an error message dialogbox saying
"Failed to create a ImageSource from the text '..\Images\Medium.png'.
" I am like @#*%&^@*#@#(. So can anyone please tell me what is going on with my Visual Studio2012? By the way, I can open and run the existing vs2010 projects with no problems.
I definitely neither want to do a fresh install on windows 8 nor rolling back to my windows 7. Cheers,

回答1:

To resolve that problem, I've change the permission of "modify" for "everybody" on the files

c:\windows\microsoft.net\framework\v2.0.50727\config\machine.config

and

c:\windows\microsoft.net\framework\v4.0.30319\config\machine.config

Don't know if it's the best way to do it, but at least it works.



回答2:

Do you have any codec packs installed on your system? I had a WIC codec pack for viewing RAW files in Explorer, and it resulted in the same issue you are describing. Uninstalling the codecs fixed Visual Studio for me.



回答3:

I was having various issues, including the above.

To resolve the problem on Windows 8 for VS 2012, setting it to run as administrator fixed the problem for me.

Launch icon properties->Advanced Properties->Run as administrator

I hope this helps.

Cheers, Sean



回答4:

The trace of this issue leads to Windows Imaging Component (one solution proposed was to remove FastPictureViewer, which codec affects WIC, but it was not my case). I used procmon to log all file and registry calls and found that VS2012 stumbles at the following key:

HKLM\SOFTWARE\Classes\.png - REG_SZ Content Type

I was suprized to see that Content Type for .png was set application (for .jpg it was application as well). After correcting it to image/png, not only VS2012 started successfully, but VS2010 as well, that was showing "Provide value on System.Windows.Baml2006.TypeConverterMarkupExtension threw an exception" on Win8 and caused me to try VS2012.



回答5:

I had the same problem with Visual Studio 13. uninstalling/reinstalling VS13 and all shared packages did not solved the problem.

Finally I tried to run it as administrator, as explained above and it worked.



回答6:

Just happened to me. As Eric Aubry said check the machine.config file. In my case it wasn't permission error but the fact that the file was destroyed internally. By renaming the machine.config.default everything was fixed.



回答7:

For me, this happened when I installed mysql on my machine, and it added an extra connection string to my machine config. However, since I was using a separate file for configSource, it resulted my machine config to become corrupted.

Moving the new config key to my config source from the 32bit machine config solved the issue.



回答8:

As I mentioned in that question ,

I tried almost every solution I found.

I would like to share, what I have tried and did not work and what did work and solved the problem.

Here are the "solutions" which did not work for me but claimed that they worked for some people.

1) Removing FastPictureViewer Codec Pack (which was already not installed)

2) Having a modify permission to everyone for

c:\windows\microsoft.net\framework\v2.0.50727\config\machine.config

and

c:\windows\microsoft.net\framework\v4.0.30319\config\machine.config

3) Using Procmon to see broken registries

4) Uninstalling/reinstalling VS13 and all shared packages

5) Renaming the machine.config.default to machine.config

6) Running Visual Studio as an administrator

And this what it solved it:

Simply installed all the updates for windows 8.1 (not only the important ones, also optional updates as well) and restart. It sounds crazy after spending hours and hours but that solved my problem.

Good luck!