Thursday, December 20, 2007

MSB4018: The "AssemblyInfo" task failed unexpectedly

If you have following error in TFS build:

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,

then check all your AssemblyInfo.cs files in the solution and make sure that you do not use same assemblyAttribute twice.

For example,

instead of using

[assembly: InternalsVisibleTo("xxx")]
[assembly:InternalsVisibleTo("yyy")]

use

[assembly: InternalsVisibleTo("xxx"), InternalsVisibleTo("yyy")].

Otherwise, get source code of AssemblyInfoTask, and update dictionary class part.

No comments: