thomas_woelfer on Fri, 21 Sep 2012 10:59:00
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?
CoolDadTx on Fri, 21 Sep 2012 14:50:09
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
thomas_woelfer on Mon, 24 Sep 2012 15:37:47
>> 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.
CoolDadTx on Mon, 24 Sep 2012 16:48:10
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
thomas_woelfer on Mon, 24 Sep 2012 17:46:33
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.)
CoolDadTx on Mon, 24 Sep 2012 18:24:22
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
thomas_woelfer on Mon, 24 Sep 2012 20:03:31
so here come some more hours of totally stupid settings changes... sucks.
anyhow, thanks for the pointers.