Friday, September 21, 2012 10:59 AM
I have a vs2010 solution that used to build just fine. After I installed vs2012/net 4.5, i get the following warning:
Warning 60 warning C4945: 'ExtensionAttribute' : cannot import symbol from 'c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll': as 'System::Runtime::CompilerServices::ExtensionAttribute' has already been imported from another assembly 'mscorlib' c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll 1 1 kernel.native.calculations.stuetze
i get alot of these; they make the Error List almost unuseable. How do i get rid of these warnings?
Friday, September 21, 2012 2:50 PMModerator
ExtensionAttribute was moved from System.Core to mscorlib in 4.5. They did this to several types and it is causing havoc. If you don't need 4.5 features then change the version back to 4 and it should go away. If you want to use 4.5 then make sure your managed C++ code is targeting 4.5. You might also need to remove any imports of System.Core.
Michael Taylor - 9/21/2012
Monday, September 24, 2012 3:37 PM
>> If you don't need 4.5 features then change the version back to 4 and it should go away
How do i do this. Uninstall 4.5 and install 4? That is not a real solution, as certainly some other app ultimately will install 4.5 again. I can't change to 4.5 myself, due to the not-on-xp-limitation.
Monday, September 24, 2012 4:48 PMModerator
No you just need to ensure your build is targeting v4 instead of v4.5. Open the project properties for the C++ project and change it to use the v100 compiler. See if that causes the problem to go away.
Michael Taylor - 9/24/2012
Monday, September 24, 2012 5:46 PM
Hm. This is a vs 2010 project. There's no way that i know of in the ui, where you can tell it to use one version or the other of the compiler. How would i tell it to use a different compiler? The properties of the c++ project says it's targeting .net 4.0. (which is no surprise, given the fact that this project was created long before 4.5 was even available.)
Monday, September 24, 2012 6:24 PMModerator
Ah you're still compiling in VS2010 but you installed .NET 4.5. I see. I'm afraid you're stuck like a lot of other people. .NET 4.5 is an extension of .NET 4.0 so it overwrites the existing v4 CLR. This is not much different than if you were to apply a SP to .NET 4.0. Types were shuffled around between the versions. You're running into a problem because the ExtensionAttribute was moved to another assembly.
Here's the associated Connect issue and the recommended workaround: http://connect.microsoft.com/VisualStudio/feedback/details/739838/msbuild-produces-new-warning-after-installing-net-4-5
- Marked As Answer by thomas_woelfer Monday, September 24, 2012 8:03 PM
Monday, September 24, 2012 8:03 PM
so here come some more hours of totally stupid settings changes... sucks.
anyhow, thanks for the pointers.