An item with the same key has already been added.


I have view that starts with:


Foo.cshtml: Description
Foo2.cshtml: Description2


That causes the MsBuild target to throw a dictionary exception from DirectivesParser.ParseKeyValueDirectives().

I guess it finds two keys (cshtml) with the values (Description, Description2) and it will fail to add that to the dictionary.

Current source have a TODO so I guess this is a work in progress. However, it would be nice to know which file is causing the error and perhaps treat it as a warning instead of an error.
Closed Nov 23, 2013 at 1:11 AM by davidebbo
Fixed in 1.6.1. Please verify!


davidebbo wrote Nov 22, 2013 at 9:56 PM

It's using some complex regex that somehow ends up using "cshtml" as the key in your case above, which is clearly bogus.

Agreed that the code needs to recover from this...

bennyh wrote Nov 25, 2013 at 2:33 PM

I've built it from source and used it as a msbuild target and it works. Thanks