Skip to content

Commit 057887a

Browse files
authored
Simplify .csproj files by using .props and .targets (#110)
* Simplify `.csproj` files by using `.props` and `.targets` * Fix NuGet package content paths * Simplify `.csproj`s of guides and source generators
1 parent d20e429 commit 057887a

File tree

53 files changed

+84
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+84
-384
lines changed

Directory.Build.props

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
<Project>
22

3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<LangVersion>latest</LangVersion>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9+
<IsAotCompatible>true</IsAotCompatible>
10+
<NoWarn>1591</NoWarn>
11+
</PropertyGroup>
12+
13+
<PropertyGroup>
14+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
15+
<PackageProjectUrl>https://netcord.dev</PackageProjectUrl>
16+
<PackageTags>bot;discord;discord-api</PackageTags>
17+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
18+
<Description>The modern and fully customizable C# Discord library.</Description>
19+
<PackageReadmeFile>README.md</PackageReadmeFile>
20+
<PackageIcon>ICON.png</PackageIcon>
21+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
22+
</PropertyGroup>
23+
324
<PropertyGroup>
425
<IncludeSymbols>true</IncludeSymbols>
526
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
@@ -9,4 +30,13 @@
930
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1031
</PropertyGroup>
1132

33+
<ItemGroup>
34+
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<None Include="$(MSBuildThisFileDirectory)\Resources\NuGet\README.md" Pack="true" PackagePath="" />
39+
<None Include="$(MSBuildThisFileDirectory)\Resources\NuGet\ICON.png" Pack="true" PackagePath="" />
40+
</ItemGroup>
41+
1242
</Project>

Directory.Build.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<DefineConstants>$(DefineConstants);$([System.String]::Copy('$(AssemblyName)').Replace('.', '_'))</DefineConstants>
5+
</PropertyGroup>
6+
7+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<LangVersion>latest</LangVersion>
7+
<Nullable>enable</Nullable>
8+
<AssemblyName>MyBot</AssemblyName>
9+
<RootNamespace>MyBot</RootNamespace>
10+
</PropertyGroup>
11+
12+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Project>
2+
</Project>

Documentation/guides/basic-concepts/HttpInteractions/HttpInteractions.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

Documentation/guides/basic-concepts/RespondingToInteractions/RespondingToInteractions.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

Documentation/guides/basic-concepts/SendingMessages/SendingMessages.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

Documentation/guides/basic-concepts/Sharding/Sharding.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

Documentation/guides/basic-concepts/ShardingHosting/ShardingHosting.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

Documentation/guides/basic-concepts/Voice/Voice.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<LangVersion>latest</LangVersion>
8-
<Nullable>enable</Nullable>
9-
<AssemblyName>MyBot</AssemblyName>
10-
<RootNamespace>MyBot</RootNamespace>
115
</PropertyGroup>
126

137
<ItemGroup>

0 commit comments

Comments
 (0)