Replies: 2 comments 2 replies
-
To fix the multiple entry point issue, in <ItemGroup>
<Compile Remove="Program*.cs" />
<Compile Include="Program1.cs" />
</ItemGroup> It does seem like this would be easier to achieve with multiple projects though. |
Beta Was this translation helpful? Give feedback.
2 replies
-
If you're using Example: <PropertyGroup>
<EnableDefaultItems>False</EnableDefaultItems>
</PropertyGroup>
<!-- Project 1 -->
<ItemGroup>
<Compile Include="*/**/*_P1.cs" Exclude="$(DefaultExcludesInProjectFolder);$(DefaultItemExcludes)" />
</ItemGroup>
<!-- Project 2 -->
<ItemGroup>
<Compile Include="*/**/*_P2.cs" Exclude="$(DefaultExcludesInProjectFolder);$(DefaultItemExcludes)" />
</ItemGroup> For more info, see default item inclusions in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a root directory with multiple C# projects (*.csproj).
I need MSBuild to filter the C# source files by root namespace for each project, since they share the same root directory.
Otherwise, I will get
error CS0017: Program has more than one entry point defined
when I try to run a project usingdotnet run --project Project1.csproj
.My project folder structure is organized based on features, and I want all source files related to a feature from all projects (e.g. server, client, test) to be inside the feature specific sub-folder.
Sample solution structure:
Now, how can I run/build Project1.csproj such that MSBuild will only include Program1.cs and SomeClass1.cs. Similar thing with Project2.csproj with Program2.cs and SomeClass2.cs. Can I ask MSBuild to include only files/types based on their root namespace?
Any idea how to go about this?
Beta Was this translation helpful? Give feedback.
All reactions