I have a project that generates following error on compilation:
error CS0579: Duplicate 'AssemblyVersion' attribute
I have checked the file AssemblyInfo.cs and it looks like there is no duplication there.
I found this article on MSDN which addresses a similar problem and following the suggestion in this article fixes the problem as well.
Can anyone tell me what's going on here? Does it happen only in case of having two or more projects with classes having similar names? Or is it something else?
c# visual-studio-2010 compiler-errors share improve this question edited Jun 25 '15 at 22:14 JackWhiteIII 972 2 7 22 asked Apr 25 '12 at 7:39 Aamir 9,762 3 32 61 just a guess but, did you try close and that opening the solution again? perhaps that might solve it? – Stefto Apr 25 '12 at 7:42 add a commentSince I have also run into this issue in the past, so I am going to assume that your build process also provides assembly information seperately to provide versioning. And that cause a duplication as your project also has that info in the AssembleyInfo.cs file. So remove the file and I think it should work.
share improve this answer answered Apr 25 '12 at 9:15 luqi 828 7 12 1 So, Shouldn't build process overwrite the existing AssemblyVersion instead of creating a new entry? I know that our build process does that but I am curious that why it doesn't overwrite the existing one. Is it badly implemented or is it a limitation? – Aamir Apr 25 '12 at 9:18 I think for .net assemblys the better way would be to use version injection method. But thats a seperate story. In your case the problem is there are different ways of providing assembly versions, through cmdline build parameters and through AssemblyInfo.cs and you have to make sure that only one method is being used as duplication of attributes is a .net compilation error. – luqi Apr 25 '12 at 9:32