I have error from visual studio 2010:
Error 1 The item "CrossDomainService.svc.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. WcfServiceDomain
and from msbuild
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(160,9) : error MSB3105: The item "CrossDomainService.svc.cs" was specified more than o nce in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. [C:\inetpub\Wwwroot\axaptaWcfConnection\WcfServiceDomain\WcfSer viceDomain.csproj]
My file is csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8D40933A-E036-4CD0-9003-314A692724D5}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WcfServiceDomain</RootNamespace>
<AssemblyName>WcfServiceDomain</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Configuration" />
<Reference Include="System.Drawing" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web.Services" />
</ItemGroup>
<ItemGroup>
<Content Include="ClientAccessPolicy.xml" />
<Content Include="CrossDomainService.svc" />
<Content Include="Service1.svc" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="CrossDomainService.svc.cs">
<DependentUpon>CrossDomainService.svc</DependentUpon>
</Compile>
<Compile Include="ICrossDomainService.cs" />
<Compile Include="Service1.svc.cs">
<DependentUpon>Service1.svc</DependentUpon>
</Compile>
<Compile Include="IService1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>51421</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
</Project>
I not see any duplicate :/ Any idea from this error ??
I was facing the same problem in my solution with the same error for one of the source file,
I fixed it out as follows,
Check for the file name for which the error is given.
Find out in which project the file is included.
Open the .csproj file for that particular project (This file can be found in the directory where solution is placed).
Search for the file name for which the error is thrown in the .csproj file.
You will find two entries of the line such as
<Compile Include="duplicate.aspx.cs"> <SubType>ASPXCodeBehind</SubType> <DependentUpon>Duplicate.aspx</DependentUpon> </Compile> <Compile Include="duplicate.aspx.cs"> <SubType>ASPXCodeBehind</SubType> <DependentUpon>Duplicate.aspx</DependentUpon> </Compile>
Delete any one line from one of them.
Save the changes.
Reload the project your error must have gone.
For those who encountered the same problem, nothing helped them and they do not want to recreate the project: Try to delete YourPojectName.csproj.user file. It helped me. I modified the .csproj manually before and the modification introduced (somehow) probably some discrepancy to the two files.
You could just open the solution in a regular text editor and remove the dups by hand
Easy! Just right clic in your project and select "Unload Project"
Right clic one again and edir your_project.csproj
Search a duplicate tag for the file mentioned in the error message.
Save and right clic to choose "Reload Project"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With