C
C#4d ago
yeon

✅ Dependency restores to incorrect package

I have a dotnet solution called A.sln which depends on another solution B.sln. Both A.sln and B.sln have some child projects which has some const value differences depending on the platform: * A.Win64.csproj, A.Win32.csproj, A.Posix64.csproj, A.Posix32.csproj * B.Win64.csproj, B.Win32.csproj, B.Posix64.csproj, B.Posix32.csproj For each of A's sub projects, it should depend on the right version of the B's subproject: * A.Win64.csproj -> B.Win64.csproj * A.Win32.csproj -> B.Win32.csproj * A.Posix64.csproj -> B.Posix64.csproj * A.Posix32.csproj -> B.Posix32.csproj But if I build the A.sln with dotnet build, the dependency is restored to only one version of B's subproject, for example: * A.Win64.csproj -> B.Posix64.csproj * A.Win32.csproj -> B.Posix64.csproj * A.Posix64.csproj -> B.Posix64.csproj * A.Posix32.csproj -> B.Posix64.csproj To avoid this issue, I had to manually iterate through all the sub projects like dotnet build A.Win64.csproj, dotnet build A.Win32.csproj, dotnet build A.Posix64.csproj, dotnet build A.Posix32.csproj. Is there any settings I can tweak to avoid this pitfall? Or should I file an issue about this?
27 Replies
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP4d ago
Actually, they are already on the GitHub: B : https://github.com/nalchi-net/GnsSharp A : https://github.com/nalchi-net/NalchiSharp A depends on the B via PackageReference to each nuget package
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP4d ago
Yeah
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP4d ago
I update NalchiSharp once the GnsSharp is public on nuget.org Let me clear the cache and restore NalchiSharp.sln...
Directory: D:\...\NalchiSharp\NalchiSharp\obj

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2025-03-28 오후 8:33 3007 NalchiSharp.Steamworks.Posix64.csproj.nuget.dgspec.json
-a--- 2025-03-28 오후 8:33 1592 NalchiSharp.Steamworks.Posix64.csproj.nuget.g.props
-a--- 2025-03-28 오후 8:33 150 NalchiSharp.Steamworks.Posix64.csproj.nuget.g.targets
-a--- 2025-03-28 오후 8:33 5959 project.assets.json
-a--- 2025-03-28 오후 8:33 638 project.nuget.cache
Directory: D:\...\NalchiSharp\NalchiSharp\obj

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2025-03-28 오후 8:33 3007 NalchiSharp.Steamworks.Posix64.csproj.nuget.dgspec.json
-a--- 2025-03-28 오후 8:33 1592 NalchiSharp.Steamworks.Posix64.csproj.nuget.g.props
-a--- 2025-03-28 오후 8:33 150 NalchiSharp.Steamworks.Posix64.csproj.nuget.g.targets
-a--- 2025-03-28 오후 8:33 5959 project.assets.json
-a--- 2025-03-28 오후 8:33 638 project.nuget.cache
Still, only the Posix64 is restored this way? Yep, after dotnet build NalchiSharp.sln, all the *.deps.json points to the same sub project: GnsSharp.Gns.Win32.dll Maybe I should just do it without seperate nuget packages for each configuration? But the code compiles quite differently depending on the constant, some internal class even doesn't exist in some configurations
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Hmm, should I create a seperate folders for each csproj s then? Ugh, I need to reference the source code outside of the folders then
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Because I didn't know that
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Thanks for explaining, it looks pretty handy
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
I haven't figure out how the library user can defineconstant on the referenced project without modifying the referenced project That's why I did this
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
It's a C++ binding, which has some size_t parameters
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Hmm
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
yeon
yeonOP3d ago
Is this the one you've explained? Hmm, I think I should mess around this out myself Thanks a lot for telling me about this 🙂 And I thought the CMake alone is enough headache lol
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Hmm, the link is private for me
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
yeon
yeonOP3d ago
Yeah, splitting folders resolves the issue, I guess I'll resort to this for now Thanks again!
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?