Skip to content

Commit

Permalink
Added own test copy of common items and the hard-referenced SqlServer…
Browse files Browse the repository at this point in the history
….Types package (webappsuk#65)
  • Loading branch information
josh-green committed Mar 8, 2019
1 parent 5489d83 commit cbfd4bc
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 0 deletions.
209 changes: 209 additions & 0 deletions test/Common.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Standard common properties -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<OldToolsVersion>4.0</OldToolsVersion>
<RestorePackages>true</RestorePackages>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

<!-- Force the solution directory to the same as the file -->
<SlnDir>$(MSBuildThisFileDirectory)</SlnDir>
<SlnDir Condition="!HasTrailingSlash('$(SlnDir)')">$(SlnDir)\</SlnDir>
<SolutionDir>$(SlnDir)</SolutionDir>
<ResourcesPath>$(SlnDir)WebApplications.Utilities\Resources\</ResourcesPath>
</PropertyGroup>

<!-- Configuration specific properties -->
<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<RunSignTool>false</RunSignTool>
</PropertyGroup>

<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<IsRelease>true</IsRelease>
<RunSignTool>true</RunSignTool>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'NuGet'">
<BuildPackage>true</BuildPackage>
<PackageOutputDir>$(SlnDir)..\nugets</PackageOutputDir>
<IsRelease>true</IsRelease>
<RunSignTool>true</RunSignTool>
</PropertyGroup>

<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)' == 'NuGet' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>

<PropertyGroup Condition="'$(CustomPlatforms)' != 'true'">
<OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath>
<DocumentationFile>bin\$(Configuration)\$(Platform)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<!-- Include common attributes -->
<ItemGroup>
<Compile Include="$(SlnDir)CommonAttributes.cs" />
</ItemGroup>

<!-- Gets the key file if present, otherwise builds projects unsigned -->
<PropertyGroup Condition="Exists('$(SlnDir)..\Web Applications UK.snk')">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile Condition="Exists('$(SlnDir)..\Web Applications UK.snk')">$(SlnDir)..\Web Applications UK.snk</AssemblyOriginatorKeyFile>
<DefineConstants>SIGNED;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<!-- Gets the path to sn.exe -->
<Target Name="GetSNPath" BeforeTargets="BuildPackage;VerifyStrongName" Condition="'$(SignAssembly)' == 'true'">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
</GetFrameworkSdkPath>
<Exec Command="WHERE /r &quot;$(WindowsSdkPath.TrimEnd('\\'))&quot; sn &gt; sn-path.txt" />
<ReadLinesFromFile File="sn-path.txt">
<Output TaskParameter="Lines" PropertyName="SNPath" />
</ReadLinesFromFile>
<Delete Files="sn-path.txt" />
<PropertyGroup>
<SNPath>$([System.Text.RegularExpressions.Regex]::Replace('$(SNPath)', ';.*', ''))</SNPath>
</PropertyGroup>
</Target>

<!-- Ensures that packages have a strong name -->
<Target Name="VerifyStrongName" Condition="'$(SignAssembly)' == 'true'" BeforeTargets="BuildPackage">
<Exec Command="&quot;$(SNPath)&quot; /v &quot;$(TargetPath)&quot;" />
</Target>

<!-- Standard includes -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

<!-- NuGet package restore -->
<Import Project="$(SlnDir)..\.nuget\NuGet.targets" Condition="Exists('$(SlnDir)..\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SlnDir)..\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SlnDir)..\.nuget\NuGet.targets'))" />
</Target>

<!-- Import utilities if Utilities is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('Utilities'))">
<UtilityBuildTasks>$(SlnDir)WebApplications.Utilities\BuildTasks\bin\Release\AnyCPU\WebApplications.Utilities.BuildTasks.dll</UtilityBuildTasks>
</PropertyGroup>
<ItemGroup Condition="'$(UtilityBuildTasks)'!='' AND !Exists('$(UtilityBuildTasks)')">
<ProjectsToBuild Include="$(SlnDir)WebApplications.Utilities\BuildTasks\WebApplications.Utilities.BuildTasks.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)WebApplications.Utilities\WebApplications.Utilities.targets" Condition="$(DefineConstants.Contains('Utilities'))" />

<!-- Import ILMerge if ILMerge is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('ILMerge'))">
<ILMergeBuildTask>$(SlnDir)ILMerge.Build.Task\bin\Release\AnyCPU\ILMerge.Build.Task.dll</ILMergeBuildTask>
<ILMergeTool>$(SlnDir)ILMerge.Build.Task\bin\Release\AnyCPU\ILMerge.exe</ILMergeTool>
</PropertyGroup>
<ItemGroup Condition="'$(ILMergeBuildTask)'!='' AND !Exists('$(ILMergeBuildTask)')">
<ProjectsToBuild Include="$(SlnDir)ILMerge.Build.Task\ILMerge.Build.Task.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)ILMerge.Build.Task\ILMerge.targets" Condition="$(DefineConstants.Contains('ILMerge'))" />

<!-- Import module initializer if ModuleInitializer is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('ModuleInitializer'))">
<InjectModuleInitializerTool>$(SlnDir)WebApplications.Utilities.Initializer\bin\Release\AnyCPU\Merged\WebApplications.Utilities.Initializer.dll</InjectModuleInitializerTool>
</PropertyGroup>
<ItemGroup Condition="'$(InjectModuleInitializerTool)'!='' AND !Exists('$(InjectModuleInitializerTool)')">
<ProjectsToBuild Include="$(SlnDir)WebApplications.Utilities.Initializer\WebApplications.Utilities.Initializer.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)WebApplications.Utilities.Initializer\InjectModuleInitializer.targets" Condition="$(DefineConstants.Contains('ModuleInitializer'))" />

<!-- Import PerfSetup if the PerfSetup constant is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('PerfSetup'))">
<PerfSetupTool>$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool>
<PerfSetupTool64>$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool64>
</PropertyGroup>
<ItemGroup Condition="'$(PerfSetupTool)'!='' AND !Exists('$(PerfSetupTool)')">
<ProjectsToBuild Include="$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\WebApplications.Utilities.Performance.Tools.PerfSetup.csproj">
<Properties>Configuration=Release;Platform=x86</Properties>
</ProjectsToBuild>
</ItemGroup>
<ItemGroup Condition="'$(PerfSetupTool64)'!='' AND !Exists('$(PerfSetupTool64)')">
<ProjectsToBuild Include="$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\WebApplications.Utilities.Performance.Tools.PerfSetup.csproj">
<Properties>Configuration=Release;Platform=x64</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)WebApplications.Utilities.Performance\WebApplications.Utilities.Performance.targets" Condition="$(DefineConstants.Contains('PerfSetup'))" />

<!-- Copy resources if CopyResources is defined -->
<ItemGroup Condition="$(DefineConstants.Contains('CopyResources'))">
<ResourceFiles Include="$(SlnDir)WebApplications.Utilities\Resources\**\*" />
</ItemGroup>

<!-- When running from internal build server, this will digitally sign dlls -->
<Import Project="$(SlnDir)..\WebApplicationsSignature.targets" Condition="Exists('$(SlnDir)..\WebApplicationsSignature.targets')" />

<Target Name="CopyResources" AfterTargets="AfterBuild" Condition="$(DefineConstants.Contains('CopyResources'))">
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(OutputPath)Resources\%(RecursiveDir)" />
</Target>

<!-- Setup nugets folder -->
<Target Name="SetupNuGetsDirTarget" Condition="'$(Configuration)' == 'NuGet'" BeforeTargets="BuildPackage">
<!-- Ensure we have a nugets folder -->
<MakeDir Directories="$(SlnDir)..\nugets" Condition="!Exists('$(SlnDir)..\nugets')" />

<!-- Check for existing packages matching this one and delete -->
<ItemGroup>
<DeletePackage Include="$(SlnDir)..\nugets\$([System.IO.Path]::GetFileNameWithoutExtension('$(ProjectPath)'))*.nupkg" />
</ItemGroup>
<Delete Files="@(DeletePackage)" Condition="'@(DeletePackage)' != ''" />
</Target>

<!-- Build any dependencies-->
<Target Name="BuildDependencies" Condition="'@(ProjectsToBuild)' != ''" AfterTargets="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<Message Text="Building dependencies." />
<MSBuild Projects="@(ProjectsToBuild)" />

<!-- Reset tool locations -->
<PropertyGroup>
<UtilityBuildTasks Condition="$(DefineConstants.Contains('Utilities'))">$(SlnDir)WebApplications.Utilities\BuildTasks\bin\Release\AnyCPU\WebApplications.Utilities.BuildTasks.dll</UtilityBuildTasks>
<ILMergeBuildTask Condition="$(DefineConstants.Contains('ILMerge'))">$(SlnDir)ILMerge.Build.Tasks\bin\Release\AnyCPU\ILMerge.Build.Task.dll</ILMergeBuildTask>
<InjectModuleInitializerTool Condition="$(DefineConstants.Contains('ModuleInitializer'))">$(SlnDir)WebApplications.Utilities.Initializer\bin\Release\AnyCPU\Merged\WebApplications.Utilities.Initializer.dll</InjectModuleInitializerTool>
<PerfSetupTool Condition="$(DefineConstants.Contains('PerfSetup'))">$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool>
<PerfSetupTool64 Condition="$(DefineConstants.Contains('PerfSetup'))">$(SlnDir)WebApplications.Utilities.Performance\PerfSetup\bin\Release\Merged\PerfSetup64.exe</PerfSetupTool64>
</PropertyGroup>

<!-- Verify pre-requisits -->
<Error Text="Failed to find or build the Utilities Build Tasks ('$(UtilityBuildTasks)')." Condition="'$(UtilityBuildTasks)'!='' AND !Exists('$(UtilityBuildTasks)')" />
<Error Text="Failed to find or build the ILMerge Build Task ('$(ILMergeBuildTask)')." Condition="'$(ILMergeBuildTask)'!='' AND !Exists('$(ILMergeBuildTask)')" />
<Error Text="Failed to find or build the Module initializer tool ('$(InjectModuleInitializerTool)')." Condition="'$(InjectModuleInitializerTool)'!='' AND !Exists('$(InjectModuleInitializerTool)')" />
<Error Text="Failed to find or build the PerfSetup tool ('$(PerfSetupTool)')." Condition="'$(PerfSetupTool)'!='' AND !Exists('$(PerfSetupTool)')" />
<Error Text="Failed to find or build the 64-bit PerfSetup tool ('$(PerfSetupTool64)')." Condition="'$(PerfSetupTool64)'!='' AND !Exists('$(PerfSetupTool64)')" />
</Target>
</Project>
39 changes: 39 additions & 0 deletions test/CommonAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#region © Copyright Web Applications (UK) Ltd, 2015. All rights reserved.
// Copyright (c) 2015, Web Applications UK Ltd
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of Web Applications UK Ltd nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL WEB APPLICATIONS UK LTD BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion

using System.Reflection;
using System.Runtime.InteropServices;

[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCompany("Web Applications UK Ltd")]
[assembly: AssemblyCopyright("Copyright © Web Applications UK Ltd, 2006-2015")]
[assembly: AssemblyTrademark("Web Applications")]
[assembly: AssemblyVersion("5.2.*")]
#if Utilities
[assembly: WebApplications.Utilities.AssemblySemanticVersion("{Major}.{Minor}.{Build}-RTM.{Revision}")]
#endif
Binary file not shown.
Binary file not shown.

0 comments on commit cbfd4bc

Please sign in to comment.