日期:2014-05-18  浏览次数:20782 次

C# “Sources”参数中指定了多次的错误解决方案

“Sources”参数中指定了多次。“Sources”参数不支持重复项

昨天,我在编译项目的时候出现了这个错误,解决了好长的时间都没无法解决,到最后

还是解决了,希望这篇文章能帮助遇到这个错误的人尽快解决问题。

 

问题源自于工程文件.cspro 用记事本打开工程文件,发现

 1.<ItemGroup>
    <Compile Include="Converters\AspNetAjaxDateTimeConverter.cs" />
    <Compile Include="Converters\XmlNodeConverter.cs" />
    <Compile Include="Converters\HtmlColorConverter.cs" />
    <Compile Include="JavaScriptParameters.cs" />
    <Compile Include="JavaScriptConstructor.cs" />
    <Compile Include="JsonIgnoreAttribute.cs" />
     <Compile Include="Utilities\CollectionUtils.cs" />
    <Compile Include="Utilities\ReflectionUtils.cs" />
    <Compile Include="Utilities\StringUtils.cs" />
  </ItemGroup>

发现两个一模一样的包含文件 ,删掉一个可解决问题。

 

2. 如删掉编译还不可以,要选择项目或类库的属性,将图片中的勾去掉,即可:

图:

 

注意:这两步要都操作才可以。