AssemblyInfoTask An item with the same key has already been added error
I'm using this task via TFS and Team Build
Error Log
Target UpdateAssemblyInfoFiles:
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: The "AssemblyInfo" task failed unexpectedly.
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: System.ArgumentException: An item with the same key has already been added.
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.Extras.AssemblyInfoWrapper..ctor(String filename)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.Extras.AssemblyInfo.Execute()
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
Done building target "UpdateAssemblyInfoFiles" in project "TFSBuild.proj" -- FAILED.
Assemblyinfo looks like this
using
System;using
System.Reflection;using
System.Security.Permissions;using
System.Runtime.InteropServices;[assembly:
AssemblyKeyName("")][assembly:
AssemblyTitle("removed")][assembly:
AssemblyProduct("removed")][assembly:
AssemblyDescription("removed")][assembly:
AssemblyCopyright("?removed")][assembly:
CLSCompliant(false)][assembly:
AssemblyVersion("1.0.0.0")][assembly:
AssemblyFileVersion("1.0.0.0")][assembly:
PermissionSet(SecurityAction.RequestMinimum, Name ="FullTrust")][assembly:
PermissionSet(SecurityAction.RequestOptional, Name ="Nothing")][assembly:
ComVisible(false)]
my build file is set up as in this post:http://blogs.msdn.com/gautamg/archive/2006/01/04/509146.aspx
Any ideas?
Mike
[4382 byte] By [
MFourie] at [2008-1-7]
Neil got back to my on this and solved the issue:
The problem is the two PermissionSet attributes in your .cs file. As currently written, the task only supports one instance of each attribute in the .cs file.
To work around this you can put those two attributes out in a separate .cs file for your assembly, with a name other than "assemblyinfo".
Neil
This fixed the issue.
Thanks Neil
I am facing the AssemblyInfo task error with TeamBuild.
Error Log
Target UpdateAssemblyInfoFiles:
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: The "AssemblyInfo" task failed unexpectedly.
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: System.ArgumentException: An item with the same key has already been added.
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.Extras.AssemblyInfoWrapper..ctor(String filename)
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.Extras.AssemblyInfo.Execute()
C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets(90,5): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
Done building target "UpdateAssemblyInfoFiles" in project "TFSBuild.proj" -- FAILED.
Assemblyinfo looks like this
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("removed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("removed")]
[assembly: AssemblyProduct("removed")]
[assembly: AssemblyCopyright("removed")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("removed")][assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Any suggestions?