فهرست منبع

replaced custom .props by Directory.Build.props

Vicente Penades 3 سال پیش
والد
کامیت
99f535beda

+ 2 - 6
SharpGLTF.sln

@@ -6,13 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{29566B60-311D-42A0-9E8D-C48DECDD587F}"
 	ProjectSection(SolutionItems) = preProject
 		.editorconfig = .editorconfig
-		src\Analyzers.props = src\Analyzers.props
-		src\PackageInfo.props = src\PackageInfo.props
+		src\Directory.Build.props = src\Directory.Build.props
 		README.md = README.md
 		SharpGLTF.ruleset = SharpGLTF.ruleset
-		src\SourceLink.props = src\SourceLink.props
-		src\Testing.props = src\Testing.props
-		src\Version.props = src\Version.props
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{072B725F-773F-4751-9616-E9778897C1D2}"
@@ -49,7 +45,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Plotly", "example
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.ThirdParty.Tests", "tests\SharpGLTF.ThirdParty.Tests\SharpGLTF.ThirdParty.Tests.csproj", "{38B27C0B-DB22-4CB7-A6DA-4A6C2A8385A8}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpGLTF.Trimmed.App", "tests\SharpGLTF.Trimmed.App\SharpGLTF.Trimmed.App.csproj", "{A09437F7-403C-44A2-B1FE-15CC535B64CA}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Trimmed.App", "tests\SharpGLTF.Trimmed.App\SharpGLTF.Trimmed.App.csproj", "{A09437F7-403C-44A2-B1FE-15CC535B64CA}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+ 0 - 21
src/Analyzers.props

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-
-  <PropertyGroup>
-    <AnalysisMode>AllEnabledByDefault</AnalysisMode>
-    <CodeAnalysisRuleSet>$(MsBuildThisFileDirectory)..\SharpGLTF.ruleset</CodeAnalysisRuleSet>    
-  </PropertyGroup>
-
-  <ItemGroup>
-    <AdditionalFiles Include="$(MsBuildThisFileDirectory)..\stylecop.json" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
-      <PrivateAssets>all</PrivateAssets>
-      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
-    </PackageReference>
-    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
-  </ItemGroup>
-	
-</Project>

+ 131 - 0
src/Directory.Build.props

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  
+  <!-- https://blog.johnnyreilly.com/2021/07/14/directory-build-props-c-sharp-9-for-all -->
+
+  <!-- Legal =================================================================================== -->
+
+  <PropertyGroup>
+    <Authors>Vicente Penades</Authors>    
+    <Copyright>Copyright (c) 2021 Vicente Penades</Copyright>
+    <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>    
+  </PropertyGroup>  
+
+  <!-- Configuration =================================================================================== -->
+
+  <PropertyGroup>
+    <LangVersion>8.0</LangVersion>
+    <IsPackable>true</IsPackable>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <IsTrimmable>true</IsTrimmable>
+    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
+  </PropertyGroup>
+  
+  <!-- Testing & Analysers =================================================================================== -->
+
+  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <InternalsVisibleTo Include="SharpGLTF.Core.Tests"/>
+    <InternalsVisibleTo Include="SharpGLTF.Toolkit.Tests"/>
+  </ItemGroup>
+
+  <PropertyGroup>
+    <NoWarn>1701;1702;1591;CA1062;CA1304;CA1310;CA1000</NoWarn>
+  </PropertyGroup>  
+
+  <PropertyGroup>
+    <!-- Enable all FxCop rules with NetAnalyzers
+    https://docs.microsoft.com/es-es/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers?view=vs-2022#migration-steps
+    -->
+    
+    <AnalysisMode>AllEnabledByDefault</AnalysisMode>
+    <!-- <CodeAnalysisRuleSet>$(MsBuildThisFileDirectory)..\solution.ruleset</CodeAnalysisRuleSet>  -->  
+    
+  </PropertyGroup>
+
+  <ItemGroup>
+    
+    <AdditionalFiles Include="$(MsBuildThisFileDirectory)..\stylecop.json" />
+    
+    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    
+  </ItemGroup>
+
+  <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net6.0-windows'">
+    
+    <!-- Optimization analysis only makes sense on platforms that will be actually ran -->
+
+    <!-- https://devblogs.microsoft.com/premier-developer/avoiding-struct-and-readonly-reference-performance-pitfalls-with-errorprone-net/ -->
+    <PackageReference Include="ErrorProne.NET.Structs" >
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    
+  </ItemGroup>
+  
+  <!-- Packaging =================================================================================== -->
+
+  <!-- https://andrewlock.net/version-vs-versionsuffix-vs-packageversion-what-do-they-all-mean/ -->
+  <!-- https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core -->
+  <!-- https://stackoverflow.com/questions/23533838/how-to-get-buildid-in-msbuild -->
+  
+  <PropertyGroup>
+    <PackageIcon>glTF2Sharp.png</PackageIcon>
+    <PackageTags>C# glTF 3D</PackageTags>
+    <PackageLicenseExpression>MIT</PackageLicenseExpression>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Include="$(MsBuildThisFileDirectory)..\build\Icons\glTF2Sharp.png" Pack="true" Visible="false" PackagePath="" />
+  </ItemGroup>
+
+  <PropertyGroup>
+    <RepositoryType>git</RepositoryType>
+    <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>    
+    <PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
+    <PublishRepositoryUrl>true</PublishRepositoryUrl>    
+  </PropertyGroup>  
+  
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <VersionPrefix>1.0.0</VersionPrefix>
+    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <Deterministic>true</Deterministic>
+    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+    <IncludeSymbols>true</IncludeSymbols>
+    <SymbolPackageFormat>snupkg</SymbolPackageFormat>    
+    
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
+    <DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
+  </PropertyGroup>
+
+  <!-- strong name signing -->
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <SignAssembly>true</SignAssembly>
+    <DelaySign>false</DelaySign>
+    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SharpGLTF.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+
+  <!-- Source Control =================================================================================== -->
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">   
+
+    <!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md -->
+    
+    <EmbedAllSources>true</EmbedAllSources>
+    <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
+    <!--<EmbedUntrackedSources>true</EmbedUntrackedSources>-->
+    
+  </PropertyGroup>
+  
+</Project>

+ 0 - 34
src/PackageInfo.props

@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
-
-  <PropertyGroup>
-
-    <Authors>Vicente Penades</Authors>
-    <Copyright>Copyright (c) 2021 Vicente Penades</Copyright>
-    <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>
-
-    <RepositoryType>git</RepositoryType>
-    <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>    
-    <PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
-
-    <PackageTags>C# glTF 3D</PackageTags>    
-    <PackageIcon>glTF2Sharp.png</PackageIcon>
-
-    <DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
-
-  </PropertyGroup>
-
-  <!-- https://github.com/NuGet/Home/wiki/Packaging-License-within-the-nupkg#project-properties -->
-
-  <PropertyGroup>
-    <PackageLicenseExpression>MIT</PackageLicenseExpression>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <None Include="$(MsBuildThisFileDirectory)..\build\Icons\glTF2Sharp.png" Pack="true" Visible="false" PackagePath="" />
-  </ItemGroup>
-
-  
-
-
-</Project>

+ 2 - 18
src/SharpGLTF.Core/SharpGLTF.Core.csproj

@@ -3,26 +3,14 @@
   <PropertyGroup>    
     <TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
     <AssemblyName>SharpGLTF.Core</AssemblyName>
-    <RootNamespace>SharpGLTF</RootNamespace>
-    <LangVersion>7.3</LangVersion>    
+    <RootNamespace>SharpGLTF</RootNamespace>    
   </PropertyGroup>
 
   <PropertyGroup>
     <!--
     <DefineConstants>TRACE;SUPRESSTRYCATCH</DefineConstants>
     -->
-  </PropertyGroup>
-
-  <Import Project="..\PackageInfo.props" />
-  <Import Project="..\Version.props" />
-  <Import Project="..\Analyzers.props" />
-  <Import Project="..\Testing.props" />
-  <Import Project="..\SourceLink.props" />
-
-  <PropertyGroup>
-    <IsTrimmable>true</IsTrimmable>
-    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
-  </PropertyGroup>
+  </PropertyGroup>  
   
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Diagnostics\Guard.cs" />
@@ -37,10 +25,6 @@
     <None Include="Schema2\Generated\*.cs">
       <ExcludeFromStyleCop>true</ExcludeFromStyleCop>
     </None>
-  </ItemGroup>
-
-  <ItemGroup>
-    <None Include="..\..\.editorconfig" Link=".editorconfig" />
   </ItemGroup>  
 
 </Project>

+ 1 - 13
src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj

@@ -4,20 +4,8 @@
     <TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
     <AssemblyName>SharpGLTF.Toolkit</AssemblyName>
     <RootNamespace>SharpGLTF</RootNamespace>    
-    <LangVersion>7.3</LangVersion>    
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>    
-  </PropertyGroup>
-
-  <Import Project="..\PackageInfo.props" />
-  <Import Project="..\Version.props" />
-  <Import Project="..\Analyzers.props" />
-  <Import Project="..\Testing.props" />
-  <Import Project="..\SourceLink.props" />
-
-  <PropertyGroup>
-    <IsTrimmable>true</IsTrimmable>
-    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
-  </PropertyGroup>
+  </PropertyGroup>  
 
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Diagnostics\Guard.cs" />

+ 0 - 26
src/SourceLink.props

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
-
-  <!-- https://github.com/dotnet/sourcelink/#using-sourcelink -->
-
-  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-
-    <Deterministic>true</Deterministic>
-
-    <GitRepositoryRemoteName>github</GitRepositoryRemoteName>
-
-    <!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
-    <PublishRepositoryUrl>true</PublishRepositoryUrl>
-
-    <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
-    <EmbedUntrackedSources>true</EmbedUntrackedSources>
-
-    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
-
-  </PropertyGroup>
-
-  <ItemGroup Condition=" '$(Configuration)' == 'Release' ">
-    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
-  </ItemGroup>
-	
-</Project>

+ 0 - 9
src/Testing.props

@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
-
-  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
-    <InternalsVisibleTo Include="SharpGLTF.Core.Tests"/>
-    <InternalsVisibleTo Include="SharpGLTF.Toolkit.Tests"/>
-  </ItemGroup>  
-	
-</Project>

+ 0 - 34
src/Version.props

@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
-
-  <!-- https://andrewlock.net/version-vs-versionsuffix-vs-packageversion-what-do-they-all-mean/ -->
-  <!-- https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core -->
-  <!-- https://stackoverflow.com/questions/23533838/how-to-get-buildid-in-msbuild -->
-
-  <PropertyGroup>
-    <VersionPrefix>1.0.0</VersionPrefix>    
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <DebugSymbols>true</DebugSymbols>
-  </PropertyGroup>
-
-  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">    
-
-    <!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
-    <IncludeSymbols>true</IncludeSymbols>
-    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
-    
-    <!-- Required -->
-    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>    
-    
-  </PropertyGroup>
-
-  <!-- strong name signing -->
-  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-    <SignAssembly>true</SignAssembly>
-    <DelaySign>false</DelaySign>
-    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SharpGLTF.snk</AssemblyOriginatorKeyFile>
-  </PropertyGroup>  
-	
-</Project>

+ 1 - 3
tests/SharpGLTF.Trimmed.App/SharpGLTF.Trimmed.App.csproj

@@ -3,9 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>net6.0</TargetFramework>    
-  </PropertyGroup>
-
-  <Import Project="..\..\src\Analyzers.props" />
+  </PropertyGroup>  
 
   <PropertyGroup>
     <PublishTrimmed>true</PublishTrimmed>