[meta]common csproj/vcxproj settings to Directory.Build.props (#17067)

* Add common csproj/vcxproj settings to Directory.Build.props

* Set TreatWarningsAsErrors to true for all c# projects

* Minor fixes in unit test projects where Analyzers where not enabled before

* Clean up Directory.Build.props

* Remove properties from ImageResizer csprojs files
This commit is contained in:
CleanCodeDeveloper 2022-03-18 17:47:18 +01:00 committed by GitHub
parent f4f8a1bd69
commit 2e3a2b3f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 34 deletions

View File

@ -1,8 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <Project>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Copyright>Copyright (C) 2022 Microsoft Corporation</Copyright>
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
<AssemblyCopyright>Copyright (C) 2022 Microsoft Corporation</AssemblyCopyright>
<AssemblyProduct>PowerToys</AssemblyProduct>
<Company>Microsoft Corporation</Company>
<NeutralLanguage>en-US</NeutralLanguage>
<Platforms>x64</Platforms>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<_PropertySheetDisplayName>PowerToys.Root.Props</_PropertySheetDisplayName> <_PropertySheetDisplayName>PowerToys.Root.Props</_PropertySheetDisplayName>
<ForceImportBeforeCppProps>$(MsbuildThisFileDirectory)\Cpp.Build.props</ForceImportBeforeCppProps> <ForceImportBeforeCppProps>$(MsbuildThisFileDirectory)\Cpp.Build.props</ForceImportBeforeCppProps>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -177,6 +177,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
src\.editorconfig = src\.editorconfig src\.editorconfig = src\.editorconfig
.vsconfig = .vsconfig .vsconfig = .vsconfig
Directory.Build.props = Directory.Build.props
Solution.props = Solution.props Solution.props = Solution.props
EndProjectSection EndProjectSection
EndProject EndProject

View File

@ -8,28 +8,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ImageResizer</RootNamespace> <RootNamespace>ImageResizer</RootNamespace>
<AssemblyName>ImageResizer.Test</AssemblyName> <AssemblyName>ImageResizer.Test</AssemblyName>
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
<AssemblyCopyright>Copyright (C) 2022 Microsoft Corp.</AssemblyCopyright>
<Version>$(Version).0</Version> <Version>$(Version).0</Version>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\modules\ImageResizer\$(AssemblyName)\</OutputPath> <OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\modules\ImageResizer\$(AssemblyName)\</OutputPath>
<CodeAnalysisRuleSet>..\..\..\codeAnalysis\Rules.ruleset</CodeAnalysisRuleSet>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup>
<Platform Condition="'$(Platform)'==''">x64</Platform>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath> <IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="TestMetadataIssue1928.jpg" /> <None Remove="TestMetadataIssue1928.jpg" />
<None Remove="TestMetadataIssue1928_NoMetadata.jpg" /> <None Remove="TestMetadataIssue1928_NoMetadata.jpg" />

View File

@ -3,44 +3,31 @@
<PropertyGroup> <PropertyGroup>
<AssemblyTitle>PowerToys.ImageResizer</AssemblyTitle> <AssemblyTitle>PowerToys.ImageResizer</AssemblyTitle>
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
<AssemblyCopyright>Copyright (C) 2022 Microsoft Corp.</AssemblyCopyright>
<CodeAnalysisRuleSet>..\..\..\codeAnalysis\Rules.ruleset</CodeAnalysisRuleSet>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\modules\ImageResizer</OutputPath> <OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\modules\ImageResizer</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Platform Condition="'$(Platform)'==''">x64</Platform>
<ProjectGuid>{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}</ProjectGuid> <ProjectGuid>{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>ImageResizer</RootNamespace> <RootNamespace>ImageResizer</RootNamespace>
<AssemblyName>PowerToys.ImageResizer</AssemblyName> <AssemblyName>PowerToys.ImageResizer</AssemblyName>
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework> <TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath> <IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Resources\ImageResizer.ico</ApplicationIcon> <ApplicationIcon>Resources\ImageResizer.ico</ApplicationIcon>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -93,11 +93,11 @@ namespace Microsoft.Plugin.Folder.UnitTests
// Assert // Assert
if (hasValues) if (hasValues)
{ {
Assert.IsTrue(results.Count() > 0); Assert.IsTrue(results.Any());
} }
else else
{ {
Assert.IsTrue(results.Count() == 0); Assert.IsFalse(results.Any());
} }
} }
} }

View File

@ -16,6 +16,7 @@ using Moq;
namespace GcodePreviewHandlerUnitTests namespace GcodePreviewHandlerUnitTests
{ {
[STATestClass] [STATestClass]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "new Exception() is fine in test projects.")]
public class GcodePreviewHandlerTest public class GcodePreviewHandlerTest
{ {
[TestMethod] [TestMethod]

View File

@ -16,6 +16,7 @@ using Moq;
namespace PdfPreviewHandlerUnitTests namespace PdfPreviewHandlerUnitTests
{ {
[STATestClass] [STATestClass]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "new Exception() is fine in test projects.")]
public class PdfPreviewHandlerTest public class PdfPreviewHandlerTest
{ {
[TestMethod] [TestMethod]

View File

@ -17,6 +17,7 @@ using PreviewHandlerCommon;
namespace SvgPreviewHandlerUnitTests namespace SvgPreviewHandlerUnitTests
{ {
[STATestClass] [STATestClass]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "new Exception() is fine in test projects.")]
public class SvgPreviewControlTests public class SvgPreviewControlTests
{ {
[TestMethod] [TestMethod]