Configure .csproj

Hey guys, I have a problem, so let's start what I need I need two .csprojs in same directory, (screenshot 1), first .csproj should include only **/Client/**/*.cs files, second one **/Server/**/*.cs, and that kinda works, it seems to include .cs files but for some reason client .csproj includes server .cs files, here are my configuration files: Client:
<Project Sdk="CitizenFX.Sdk.Client/0.2.3">
<PropertyGroup>
<LangVersion>latest</LangVersion>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<Nullable>enable</Nullable>
<DefineConstants>CLIENT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />

<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>../../../Dlls\Newtonsoft.Json.dll</HintPath>
</Reference>

<None Remove="**/*.cs" />
<None Remove="**/Server/**/*.cs" />
<Compile Include="../Helpers/**/*.cs" />
<Compile Include="../Exports/**/*.cs" />
<Compile Include="**/Client/**/*.cs" />
<Compile Include="**/Shared/**/*.cs" />
</ItemGroup>
</Project>
<Project Sdk="CitizenFX.Sdk.Client/0.2.3">
<PropertyGroup>
<LangVersion>latest</LangVersion>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<Nullable>enable</Nullable>
<DefineConstants>CLIENT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />

<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>../../../Dlls\Newtonsoft.Json.dll</HintPath>
</Reference>

<None Remove="**/*.cs" />
<None Remove="**/Server/**/*.cs" />
<Compile Include="../Helpers/**/*.cs" />
<Compile Include="../Exports/**/*.cs" />
<Compile Include="**/Client/**/*.cs" />
<Compile Include="**/Shared/**/*.cs" />
</ItemGroup>
</Project>
Server:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugType>portable</DebugType>
<TargetName>$(AssemblyName).net</TargetName>
<DefineConstants>SERVER</DefineConstants>
<LangVersion>latest</LangVersion>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<Nullable>enable</Nullable>
<DefineConstants>SERVER</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CitizenFX.Core.Server" Version="1.0.*" />

<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />

<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>../../../Dlls\Newtonsoft.Json.dll</HintPath>
</Reference>

<None Remove="**/*.cs" />
<None Remove="**/Client/**/*.cs" />
<Compile Include="../Helpers/**/*.cs" />
<Compile Include="../Exports/**/*.cs" />
<Compile Include="**/Server/**/*.cs" />
<Compile Include="**/Shared/**/*.cs" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugType>portable</DebugType>
<TargetName>$(AssemblyName).net</TargetName>
<DefineConstants>SERVER</DefineConstants>
<LangVersion>latest</LangVersion>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<Nullable>enable</Nullable>
<DefineConstants>SERVER</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CitizenFX.Core.Server" Version="1.0.*" />

<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />

<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>../../../Dlls\Newtonsoft.Json.dll</HintPath>
</Reference>

<None Remove="**/*.cs" />
<None Remove="**/Client/**/*.cs" />
<Compile Include="../Helpers/**/*.cs" />
<Compile Include="../Exports/**/*.cs" />
<Compile Include="**/Server/**/*.cs" />
<Compile Include="**/Shared/**/*.cs" />
</ItemGroup>
</Project>
No description
21 Replies
borsuk (dc blocked me messages)
also, how do I know it loads wrong csproj?
borsuk (dc blocked me messages)
thanks in advance!
ero
ero2mo ago
Why do you need 2 project files in the same directory? This is not ever how it works Nobody ever does this, for reasons that have become clear to you One project per directory, always
borsuk (dc blocked me messages)
I was working before with two separated directories Client and Server, but project layout was very unclear
ero
ero2mo ago
How is this less unclear?
borsuk (dc blocked me messages)
I need "per-resource" split
ero
ero2mo ago
When all files are mashed together?
borsuk (dc blocked me messages)
I know for c# project it may look unclear, but for fivem resource it is clear added what's next?
ero
ero2mo ago
Why are you including NSJ as a DLL? Why NSJ at all?
borsuk (dc blocked me messages)
because fivem client doesnt support new c# which newtonsoft works with
borsuk (dc blocked me messages)
now I think something is wrong
No description
ero
ero2mo ago
What does that even mean?
borsuk (dc blocked me messages)
it works with my local files but doesnt load c# packages its old c# version not updated for years
ero
ero2mo ago
What does the language version have to do with anything?
borsuk (dc blocked me messages)
I dont know man, it just throws a lot of errors for client and I found solution on google to use old newtonsoftjson dll and it works why would I care about that that much? tried it, doesn't work throws a lot of errors
borsuk (dc blocked me messages)
Cfx.re Community
FiveM C#, Use Newtonsoft.Json.dll in Client script
I somehow can’t get the Newtonsoft.Json.ddl assembly to work in a client script, I have the portable version of newtonsoft.json in my project but in fivem I get the error Newtonsoft.Json: File not found.
borsuk (dc blocked me messages)
no I dont think so it compiles with it, but throws errors when ran MySqlConnector doesnt compile at all it was working before, im just restructurizing project yes wait a minute, I need to change one thing and let you know if it compiles ok it loaded most of the packages correctly
borsuk (dc blocked me messages)
now only fails to load CitizenFX
No description
borsuk (dc blocked me messages)
for client I was using sdk <Project Sdk="CitizenFX.Sdk.Client/0.2.3"> and for server <PackageReference Include="CitizenFX.Core.Server" Version="1.0.*" />
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?