WindowsAppSDK/Directory.Build.props

74 строки
4.6 KiB
Plaintext
Исходник Обычный вид История

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. -->
<!-- This is a special MSBuild file that is parsed before everything else when MSBuild detects it in our directory structure.
Adding Sdk="Microsoft.NET.Sdk" to a project causes NuGet files to be generated very early on, so we need these defines to be here
to ensure that all of our build output files end up in the same location. -->
<Project InitialTargets="DirectoryBuildPropsInfo" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="eng\Versions.props" />
<!-- Due to import ordering inconsistencies between different project types, we import this file from multiple places. -->
<Import Project="$(MSBuildThisFileDirectory)build\EnsureOutputLayout.props" Condition="$(EnsureOutputLayoutPropsIncluded) == ''" />
<PropertyGroup>
<IsTDPConfiguration>false</IsTDPConfiguration>
<GeneratedFilesDir>$(BaseIntermediateOutputPath)Generated Files\</GeneratedFilesDir>
<GenerateProjectSpecificOutputFolder>True</GenerateProjectSpecificOutputFolder>
<ForceImportAfterCppTargets>$(BuildRoot)AfterCpp.targets</ForceImportAfterCppTargets>
2021-07-15 22:29:42 +03:00
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<!-- Compilation differs for the build pipeline vs local development -->
<PropertyGroup Condition="$(WindowsAppSDKBuildPipeline) != '1'">
<!-- If not set, default it to no . -->
<WindowsAppSDKBuildPipeline>0</WindowsAppSDKBuildPipeline>
</PropertyGroup>
<Target Name="DirectoryBuildPropsInfo">
<Message Condition="'$(WindowsAppSDKBuildPipeline)' == '1'" Importance="High" Text="Directory.Build.props detects WindowsAppSDKBuildPipeline=$(WindowsAppSDKBuildPipeline)"/>
Generate cert (#1986) * Update DevCheck to generate MSTest.pfx/.cer * Refactor temp handling. Add .user dir * Change cert handling to use .user\* and direct certificate handler via Powershell's PKI module. Buh-bye all references to MSTest.* and certutil * Add -Remove-DevTestCert and -Remove-DevTestPfx * Change all temp\MSTest.pfx to .user\winappsdk.certificate.test.pfx * Added -CertPasswordFile, -CertPasswordUser, -RemoveAll. Save password as plaintext to .pwd file for later use * Update makemsix.cmd to pass along the .pwd content needed to use the (now password protected) .pfx * Update MSTest references * Start of changing NMAKEfiles to MSBuild * Add new file * MakeMsix.targets works! Rewrote DDLM.msix to work it out, when running a specific project (e.g. 'msbuild /bl /p:Configuration=Debug,Platform=x64 /t:Build test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj'). Now to verify it works when building the solution, moving MakeMsix.targets out to root\build and propogating this to the other makemsix projects * 'msbuild foo.vcxproj' works but 'msbuild bar.sln' fails due to 'C:\source\repos\windowsappsdk\test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj error MSB4057: The target GetProjectInfoForReference does not exist in the project. [C:\source\repos\windowsappsdk\' Seems GetPRojectInfoForReference is referenced by 'C:\ProgramFiles (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets' and Microsoft.Makefile.targets, we don't fit either but they're required to resolve '<ProjectReference...'? Is it possible to move the ProjectReference dependency to the .sln? Or make this work without trying to make a full blown C++ or NMake project? Time to ping some VS/MSBuild experts... * Tweaked the vcxproj to successfully create .msix via MakeMSIX! * Moved MakeMSIX.targets to the root (with other build files) * It works! Got the test projects building with the .pfx and .pwd * Rewiring test projects to use MakeMsix.targets instead of NMake * Yet more MakeMsix fixup * Fixed the package name * Added dummy Clean command (for now) * Fixed Deployment's test package where source files get put to different subdir+filename inside the msix * Fix DevCheck Start-Service to gracefully degrade if not running as admin * DeploymentTests were missing a build order dependency on BootstrapDLL project * Updated DevCheck generated cert to have 12-month lifespan (like current one) * Move Framework.* projects from makemsix.cmd to MakeMSIX.targets * Delete makemsix.cmd (obsolete) * Updated test projects to use static manifests instead of generated from a template (unnecessary complexity) * Deleted obsolete MakeAppxManifestFromTemplate.* * Removed obsolete manifest/template handling. Removed printfery debugging * Minor syntax cleanup. Fixed appxmanifest overly aggressive copy/paste human error <sheepish grin>. Fixed publish-header delete-custom-build-step human error * Fixup Math framework header publishing (due to bad merge due to the age of this change and other work in other branches that hit main. Grrr) * Deleted obsolete files * Replaced SolutionDir with RepoRoot * Rewrote installer's testpackage creation project to use MakeMSIX * Fixed naming inconsistencies * Addressed some issues. More to come * Fixed Get-UserPath emitting New-Item result to the output stream thus when creating the .user directory return $user returned System.Object[] with 2 objects in the stream (filename twice). Well, that was fun * Fix bad merge * Added Clean support to MakeMSIX. Cleanup up some internals including dependencies. MakeMsixOutputFilename is no longer optional and inferred; it must be defined by a project before import'ing makemsix.targets * Optimized load-test-cert-password to a global done once instead of per import rof makemsix.targets * Updated projects to use the common RepoTestCertificate* * Removed obsolete and redundant <Error> check * Added file-existence check before readng file. Added error check at start of project to flag missing-devcheck-artifacts early rather than late * Test WTH is going on * Remove debugging printfery. NOTE: Separate Jobs in a pipeline (will? may?) run in parallel on different machines. Until build-mrt.yml is merged into WindowsAppSDK-BuildProject-Steps.yml any common setup (or cleanup) needs to be done in both. Also, it means MRTCore *cannot* use any APIs in WindowsAppRuntime.sln because they're technically peers * Add DevCheck support to RunTestsInHelix job
2022-01-26 09:41:38 +03:00
<Error Condition="!Exists('$(RepoTestCertificatePFX)')" Text="$(RepoTestCertificatePFX) not found. Run '$(RepoRoot)\tools\DevCheck.cmd' to generate the test certificate." />
<Error Condition="!Exists('$(RepoTestCertificatePWD)')" Text="$(RepoTestCertificatePWD) not found. Run '$(RepoRoot)\tools\DevCheck.cmd' to generate the test certificate." />
</Target>
<!-- Conditional behavior for build pipeline vs local development -->
<ItemDefinitionGroup Condition="$(WindowsAppSDKBuildPipeline) == '1'">
<ClCompile>
<PreprocessorDefinitions>WINDOWSAPPSDK_BUILD_PIPELINE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\build\override;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WINDOWSAPPSDK_BUILD_PIPELINE=1;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\build\override;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<PreprocessorDefinitions>WINDOWSAPPSDK_BUILD_PIPELINE=1;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\build\override;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</Midl>
</ItemDefinitionGroup>
Commonize Hybrid CRT support (#1026) * Move Hybrid CRT support out of individual project files up to the project level as a whole * Remove unnecesasry Store-app-ness that fails the Hybrid CRT support * Stop enabling DebugLibraries to avoid bringing in debug VC CRT DLL dependencies (violating the Hybrid CRT rules) * Add DesktopCompatible to MrtCoreManagedTest for future reference - it doesn't hurt, but it doesn't help (at least, not this issue). Also added Win32Proj keyword to M.AM.Resources project. We now have 1 root issue * Removed MrtCoreManagedTest from the build due to a fundamental incompatibility (ut's a Universal Windows project referencing Microsoft.ApplicationModel.Resources (the WinRT dll) which isn't, and VS doesn't like crossing streams. Even worse, VS and msbuild produce different results!). * Revert "Removed MrtCoreManagedTest from the build due to a fundamental incompatibility (ut's a Universal Windows project referencing Microsoft.ApplicationModel.Resources (the WinRT dll) which isn't, and VS doesn't like crossing streams. Even worse, VS and msbuild produce different results!)." This reverts commit 6f4b23dd1057ee2d0c2c0684aedcd3797adfbaa3. * Doing things to workaround MrtCoreManagedTest is a Univesal Windows project. Epic Failure. Because it's a Universal Windows project MSTest is creating $(OutDir)AppX subdir and copying files ***it knows about*** to the subdir. This brutal hack fails because File.Exists() for files in the parent directory fails, and that's because the last var pc = ... tries to access the AppX directory's parent ***and fails because Access Denied***. Previously doing the copy in the .csproj fails because the AppX directory doesn't necesarily exist before the test runs, and MD $(OutDir)AppX before copying files is pointless because MSTest is deleting all the files (if any) in the AppX directory when the test starts. So dead end upon dead end. Only way is to find a way to bench the Universal Windows .props logic to understand the files it doesn't want to allow through the ...Transitive... copy rules. Or just rewrite the project as a non-Universal Windows project. Or rewrite the test using TAEF instead of MSTest. Or... drink heavily. Hunting up Scott tomorrow hoping he has an idea * Hah! Thank you ScottJ! ReferenceCopyLocalPaths does the right thing, copying the needed DLLs into $(OutDir) *and* $(OutDir)AppX and the tests now find the dll and pass * Remove debugging hackery
2021-08-17 23:17:35 +03:00
<!-- Build with the hybrid CRT (Universal CRT + Static VS CRT (for what little the Universal CRT doesn't cover) -->
<Import Project="$(MSBuildThisFileDirectory)HybridCRT.props" />
Generate cert (#1986) * Update DevCheck to generate MSTest.pfx/.cer * Refactor temp handling. Add .user dir * Change cert handling to use .user\* and direct certificate handler via Powershell's PKI module. Buh-bye all references to MSTest.* and certutil * Add -Remove-DevTestCert and -Remove-DevTestPfx * Change all temp\MSTest.pfx to .user\winappsdk.certificate.test.pfx * Added -CertPasswordFile, -CertPasswordUser, -RemoveAll. Save password as plaintext to .pwd file for later use * Update makemsix.cmd to pass along the .pwd content needed to use the (now password protected) .pfx * Update MSTest references * Start of changing NMAKEfiles to MSBuild * Add new file * MakeMsix.targets works! Rewrote DDLM.msix to work it out, when running a specific project (e.g. 'msbuild /bl /p:Configuration=Debug,Platform=x64 /t:Build test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj'). Now to verify it works when building the solution, moving MakeMsix.targets out to root\build and propogating this to the other makemsix projects * 'msbuild foo.vcxproj' works but 'msbuild bar.sln' fails due to 'C:\source\repos\windowsappsdk\test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj error MSB4057: The target GetProjectInfoForReference does not exist in the project. [C:\source\repos\windowsappsdk\' Seems GetPRojectInfoForReference is referenced by 'C:\ProgramFiles (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets' and Microsoft.Makefile.targets, we don't fit either but they're required to resolve '<ProjectReference...'? Is it possible to move the ProjectReference dependency to the .sln? Or make this work without trying to make a full blown C++ or NMake project? Time to ping some VS/MSBuild experts... * Tweaked the vcxproj to successfully create .msix via MakeMSIX! * Moved MakeMSIX.targets to the root (with other build files) * It works! Got the test projects building with the .pfx and .pwd * Rewiring test projects to use MakeMsix.targets instead of NMake * Yet more MakeMsix fixup * Fixed the package name * Added dummy Clean command (for now) * Fixed Deployment's test package where source files get put to different subdir+filename inside the msix * Fix DevCheck Start-Service to gracefully degrade if not running as admin * DeploymentTests were missing a build order dependency on BootstrapDLL project * Updated DevCheck generated cert to have 12-month lifespan (like current one) * Move Framework.* projects from makemsix.cmd to MakeMSIX.targets * Delete makemsix.cmd (obsolete) * Updated test projects to use static manifests instead of generated from a template (unnecessary complexity) * Deleted obsolete MakeAppxManifestFromTemplate.* * Removed obsolete manifest/template handling. Removed printfery debugging * Minor syntax cleanup. Fixed appxmanifest overly aggressive copy/paste human error <sheepish grin>. Fixed publish-header delete-custom-build-step human error * Fixup Math framework header publishing (due to bad merge due to the age of this change and other work in other branches that hit main. Grrr) * Deleted obsolete files * Replaced SolutionDir with RepoRoot * Rewrote installer's testpackage creation project to use MakeMSIX * Fixed naming inconsistencies * Addressed some issues. More to come * Fixed Get-UserPath emitting New-Item result to the output stream thus when creating the .user directory return $user returned System.Object[] with 2 objects in the stream (filename twice). Well, that was fun * Fix bad merge * Added Clean support to MakeMSIX. Cleanup up some internals including dependencies. MakeMsixOutputFilename is no longer optional and inferred; it must be defined by a project before import'ing makemsix.targets * Optimized load-test-cert-password to a global done once instead of per import rof makemsix.targets * Updated projects to use the common RepoTestCertificate* * Removed obsolete and redundant <Error> check * Added file-existence check before readng file. Added error check at start of project to flag missing-devcheck-artifacts early rather than late * Test WTH is going on * Remove debugging printfery. NOTE: Separate Jobs in a pipeline (will? may?) run in parallel on different machines. Until build-mrt.yml is merged into WindowsAppSDK-BuildProject-Steps.yml any common setup (or cleanup) needs to be done in both. Also, it means MRTCore *cannot* use any APIs in WindowsAppRuntime.sln because they're technically peers * Add DevCheck support to RunTestsInHelix job
2022-01-26 09:41:38 +03:00
<!-- Build with APIscan-friendly compiler+linker options -->
<Import Project="$(MSBuildThisFileDirectory)ApiScan.Cpp.props" />
Generate cert (#1986) * Update DevCheck to generate MSTest.pfx/.cer * Refactor temp handling. Add .user dir * Change cert handling to use .user\* and direct certificate handler via Powershell's PKI module. Buh-bye all references to MSTest.* and certutil * Add -Remove-DevTestCert and -Remove-DevTestPfx * Change all temp\MSTest.pfx to .user\winappsdk.certificate.test.pfx * Added -CertPasswordFile, -CertPasswordUser, -RemoveAll. Save password as plaintext to .pwd file for later use * Update makemsix.cmd to pass along the .pwd content needed to use the (now password protected) .pfx * Update MSTest references * Start of changing NMAKEfiles to MSBuild * Add new file * MakeMsix.targets works! Rewrote DDLM.msix to work it out, when running a specific project (e.g. 'msbuild /bl /p:Configuration=Debug,Platform=x64 /t:Build test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj'). Now to verify it works when building the solution, moving MakeMsix.targets out to root\build and propogating this to the other makemsix projects * 'msbuild foo.vcxproj' works but 'msbuild bar.sln' fails due to 'C:\source\repos\windowsappsdk\test\DynamicDependency\data\DynamicDependencyLifetimeManager.Msix\DynamicDependencyLifetimeManager.Msix.vcxproj error MSB4057: The target GetProjectInfoForReference does not exist in the project. [C:\source\repos\windowsappsdk\' Seems GetPRojectInfoForReference is referenced by 'C:\ProgramFiles (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets' and Microsoft.Makefile.targets, we don't fit either but they're required to resolve '<ProjectReference...'? Is it possible to move the ProjectReference dependency to the .sln? Or make this work without trying to make a full blown C++ or NMake project? Time to ping some VS/MSBuild experts... * Tweaked the vcxproj to successfully create .msix via MakeMSIX! * Moved MakeMSIX.targets to the root (with other build files) * It works! Got the test projects building with the .pfx and .pwd * Rewiring test projects to use MakeMsix.targets instead of NMake * Yet more MakeMsix fixup * Fixed the package name * Added dummy Clean command (for now) * Fixed Deployment's test package where source files get put to different subdir+filename inside the msix * Fix DevCheck Start-Service to gracefully degrade if not running as admin * DeploymentTests were missing a build order dependency on BootstrapDLL project * Updated DevCheck generated cert to have 12-month lifespan (like current one) * Move Framework.* projects from makemsix.cmd to MakeMSIX.targets * Delete makemsix.cmd (obsolete) * Updated test projects to use static manifests instead of generated from a template (unnecessary complexity) * Deleted obsolete MakeAppxManifestFromTemplate.* * Removed obsolete manifest/template handling. Removed printfery debugging * Minor syntax cleanup. Fixed appxmanifest overly aggressive copy/paste human error <sheepish grin>. Fixed publish-header delete-custom-build-step human error * Fixup Math framework header publishing (due to bad merge due to the age of this change and other work in other branches that hit main. Grrr) * Deleted obsolete files * Replaced SolutionDir with RepoRoot * Rewrote installer's testpackage creation project to use MakeMSIX * Fixed naming inconsistencies * Addressed some issues. More to come * Fixed Get-UserPath emitting New-Item result to the output stream thus when creating the .user directory return $user returned System.Object[] with 2 objects in the stream (filename twice). Well, that was fun * Fix bad merge * Added Clean support to MakeMSIX. Cleanup up some internals including dependencies. MakeMsixOutputFilename is no longer optional and inferred; it must be defined by a project before import'ing makemsix.targets * Optimized load-test-cert-password to a global done once instead of per import rof makemsix.targets * Updated projects to use the common RepoTestCertificate* * Removed obsolete and redundant <Error> check * Added file-existence check before readng file. Added error check at start of project to flag missing-devcheck-artifacts early rather than late * Test WTH is going on * Remove debugging printfery. NOTE: Separate Jobs in a pipeline (will? may?) run in parallel on different machines. Until build-mrt.yml is merged into WindowsAppSDK-BuildProject-Steps.yml any common setup (or cleanup) needs to be done in both. Also, it means MRTCore *cannot* use any APIs in WindowsAppRuntime.sln because they're technically peers * Add DevCheck support to RunTestsInHelix job
2022-01-26 09:41:38 +03:00
<!-- Load the test certificate's password (so we do it once for reuse across projects) -->
<PropertyGroup Condition="'$(RepoTestCertificatePFX)' == ''">
<RepoTestCertificatePFX>$(RepoRoot)\.user\winappsdk.certificate.test.pfx</RepoTestCertificatePFX>
</PropertyGroup>
<PropertyGroup Condition="'$(RepoTestCertificatePWD)' == ''">
<RepoTestCertificatePWD>$(RepoRoot)\.user\winappsdk.certificate.test.pwd</RepoTestCertificatePWD>
</PropertyGroup>
<PropertyGroup Condition="('$(RepoTestCertificatePWD)' != '') and Exists('$(RepoTestCertificatePWD)')">
<RepoTestCertificatePassword>$([System.IO.File]::ReadAllText('$(RepoTestCertificatePWD)').TrimEnd())</RepoTestCertificatePassword>
<RepoTestCertificatePasswordRedacted>...redacted...</RepoTestCertificatePasswordRedacted>
</PropertyGroup>
<!-- 'Clean As We Go' if necessary (specified). Prevents build agents from running out of disk space -->
<Target Name="CleanIntermediateFiles" AfterTargets="Build" Condition="'$(WindowsAppSDKCleanIntermediateFiles)' == 'true'">
<RemoveDir Directories="$(IntermediateOutputPath)" />
</Target>
</Project>