-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate CodeGen Bug when building more than once #505
Comments
For the record, I'm not sure if this is a fix or a workaround, but I found if I put in client proj file: <EnableDefaultCompileItems>false</EnableDefaultCompileItems> this bug disappears. |
I had hoped that the bug bug had been resolved in #229 where the includes are configured to remove duplciates, previously I often did something similar to below in order to avoid the problem , it might work for you From "AspNetCore.Client.CodeGen.csproj" sample project: <ItemGroup>
<Compile Remove="Generated_Code\AspNetCore.Hosting.AspNetCore.g.cs" />
<None Include="Generated_Code\AspNetCore.Hosting.AspNetCore.g.cs" />
</ItemGroup> Or just add disable EnableDefaultCompileItems and add If you have any suggestion of how this could be fixed in https://github.com/OpenRIAServices/OpenRiaServices/blob/main/src/OpenRiaServices.Tools/Framework/build/OpenRiaServices.Client.CodeGen.targets feel free to create a PR |
@Daniel-Svensson I checked output build logs, and I think maybe it could not remove duplicates because, for example, one item is pointing to I will try check for a solution, but I need to finish my deadlines first and, for now, |
That sounds promising. I think I have seen such functionality built into msbuild. Good luck with the deadline and in the meantime, the workaround is documented here. |
Note:
It is possible to make paths from openria code generation relative either in code or using https://learn.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2022#msbuild-makerelative |
Describe the bug
With the attached projects (RiaBug.zip), the SERVER project builds correctly, and the CLIENT projects build correctly, and correctly creates the generated files the FIRS TIME. For C#, the 2nd time we got a warning, and from 3rd time we do not have problems. But with VB.Net, the second time we got errors and the projects does not build anymore.
You can try in Visual Studio, but to avoid IDE quirks I tested in command line. just go to desired project folder and execute
dotnet build
.After the problem arises (for VB.Net), the only one way to build again is performing
dotnet clean
and thendotnet build
. But when you build again the problem returns.Summary:
For C#
warning CS2002: Source file 'C:\tmp\RiaBug\CS\CsClient\Generated_Code\CsServer.g.cs' specified multiple times
For VB:
To Reproduce
I added this repro in zip, but it is very very simple, I saw that problems in a big project, and then I created a MRE to test
RiaBug.zip
The server project file (same for vbproj and csproj):
The server Program.cs file:
The server Program.vb file:
The client just need the proj file:
Expected behavior
Every time the client project needs to build correctly
Nuget package and version
EDIT The same happens if I use
OpenRiaServices.Client
instead ofOpenRiaServices.Client.Core
+OpenRiaServices.Client.CodeGen
The text was updated successfully, but these errors were encountered: