Duplicate AssemblyVersion Attribute

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?

share improve this question
 
 
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

6 Answers

up vote 26 down vote accepted

Since 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
 
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 
回答: 错误信息"Duplicate attribute ' '"表示在重新构建项目时出现了重复声明属性的错误。这通常是因为在XML布局文件中重复设置了相同的属性。根据引用\[1\]的解释,<layout>标签不需要设置android:layout_width和android:layout_height属性,因此如果在该标签中设置了这些属性,就会提示重复设置属性的错误。另外,根据引用\[2\]的建议,还需要检查布局文件中的命名空间是否重复。如果在<layout>标签和<RelativeLayout>标签中都设置了相同的命名空间xmlns:android,也会导致重复属性的错误。解决这个问题的方法是删除其中一个命名空间的设置。请检查你的布局文件,确保没有重复设置属性或命名空间。 #### 引用[.reference_title] - *1* [Android: AAPT: error: duplicate attribute.](https://blog.csdn.net/FatalFlower/article/details/113884010)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [AAPT: error: duplicate attribute.](https://blog.csdn.net/zhf6751134/article/details/120531098)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值