Open RIA Services User Support The item was specified more than once in the "Sources" parameter  Viewed 17621 time(s), 4 post(s)., 9/2/2015 5:59:38 AM - by aggieben

aggieben
aggieben 9/8/2015 2:27:25 AM

I'm trying to build a project I upgraded from EF4.3/System.ServiceModel.DomainServices to EF6.1.3/OpenRiaServices, and while I was able to build the server project successfully, set up the new packages on the silverlight project and link the server project to the silverlight project, the code generation bit doesn't seem to work.  I did add the CodeGen nuget package to the silverlight project.

When I build, msbuild emits the following error:

Error35The item "C:\Users\Benjamin\Projects\MyProject\Production-OpenRia\PolicyNetwork.Business\Generated_Code\Data\PolicyDef.Shared.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter.

<div> <div><br /> </div> I used PowerShell to search for possible causes, and I found <em>only </em>one reference to a source file called "PolicyDef.Shared.cs" anywhere in the entire project:<br /> <br />
C:\Users\Benjamin\Projects\MyProject\Production-OpenRia
λ gci -rec |? { $_.FullName -notmatch 'packages|bin|obj|Referenced' } | sls "PolicyDef.Shared.cs"
 
PolicyNetwork.Business.Web\PolicyNetwork.Business.Web.csproj:136:    <Compile Include="Data\PolicyDef.Shared.cs" />

I also checked to see that there was actually only once such file in the filesystem:

C:\Users\Benjamin\Projects\MyProject\Production-OpenRia
λ gci -rec -filter "PolicyDef.Shared*"
 
 
    Directory: C:\Users\Benjamin\Projects\MyProject\Production-OpenRia\PolicyNetwork.Business\Generated_Code\Data
 
 
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-ar---         9/2/2015  12:12 AM            778 PolicyDef.Shared.cs
 
 
    Directory: C:\Users\Benjamin\Projects\MyProject\Production-OpenRia\PolicyNetwork.Business.Web\Data
 
 
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         9/2/2015  12:12 AM            778 PolicyDef.Shared.cs

The output is just a tad verbose, but there's the PolicyDef.Shared.cs source file, and then a generated one that mirrors it in the SL project (PolicyNetwork.Business - a horrible name, but it is what it is for now).

Has anyone any idea why this problem would be occurring?  Could it be a bug in the msbuild targets installed by the CodeGen package?</div>

This content has not been rated yet. 
20 Reputation 2 Total posts
1
bengutt
bengutt 9/7/2015 4:46:37 PM

When I get these kinds of errors, I delete all my bin, obj and Generated_Code folders, do a clean, then a rebuild and that seems to help out.

This content has not been rated yet. 
80 Reputation 9 Total posts
2
aggieben
aggieben 9/8/2015 2:43:53 AM

I tried this, and alas it didn't make a difference :-(

This content has not been rated yet. 
20 Reputation 2 Total posts
3
bengutt
bengutt 9/11/2015 9:16:35 AM

Try excluding the file from your project.

I've looked at the shared file we use, and it is automatically added and doesn't appear in the csproj file.

I hope this is your cause!

This content has not been rated yet. 
80 Reputation 9 Total posts
4