From 281e536d39952424f1b6cee5660dedbf8a249a90 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Tue, 23 Jun 2020 06:54:11 -0700 Subject: [PATCH] add ability to share debug/release generated files (#325) * add ability to share debug/release generated files (restore original dev workflow) * fixed issue with prerelease verify target and clarified debug/release projection builds --- Directory.Build.targets | 4 ++++ Projections/Test/Test.csproj | 8 ++++---- Projections/WinUI/WinUI.csproj | 8 ++++---- Projections/Windows/Windows.csproj | 8 ++++---- README.md | 4 +++- build.cmd | 2 +- nuget/Microsoft.Windows.CsWinRT.targets | 4 +++- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 4d90f8d5b..d10196724 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,9 @@ + + $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', 'Generated Files')) + + diff --git a/Projections/Test/Test.csproj b/Projections/Test/Test.csproj index 1838e15fd..414a8bfda 100644 --- a/Projections/Test/Test.csproj +++ b/Projections/Test/Test.csproj @@ -44,7 +44,7 @@ high - $(IntermediateOutputPath)cswinrt_test.rsp + $(GeneratedFilesDir)cswinrt_test.rsp $(CsWinRTExe) %40"$(CsWinRTResponseFile)" @@ -52,14 +52,14 @@ -verbose -in 10.0.18362.0 -in @(ReferenceWinMDs->'"%(FullPath)"', ' ') --out "$(IntermediateOutputPath)Generated Files" +-out "$(GeneratedFilesDir.TrimEnd('\'))" -exclude Windows -exclude Microsoft -include TestComponent -include TestComponentCSharp - + @@ -71,7 +71,7 @@ $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.winui', '$(MicrosoftWinUIVersion)')) - + diff --git a/Projections/WinUI/WinUI.csproj b/Projections/WinUI/WinUI.csproj index d8ba37634..7d072ba81 100644 --- a/Projections/WinUI/WinUI.csproj +++ b/Projections/WinUI/WinUI.csproj @@ -40,7 +40,7 @@ high - $(IntermediateOutputPath)cswinrt_winui.rsp + $(GeneratedFilesDir)cswinrt_winui.rsp $(CsWinrtExe) %40"$(CsWinRTResponseFile)" @@ -48,7 +48,7 @@ -verbose -in 10.0.18362.0 -in @(ReferenceWinMDs->'"%(FullPath)"', ' ') --out "$(IntermediateOutputPath)Generated Files" +-out "$(GeneratedFilesDir.TrimEnd('\'))" -exclude Windows -include Microsoft # The current WinUI nuget incorrectly references several Windows.* types that should be @@ -68,7 +68,7 @@ -include Windows.UI.Xaml.Media.Animation.ConditionallyIndependentlyAnimatableAttribute - + @@ -76,7 +76,7 @@ - + diff --git a/Projections/Windows/Windows.csproj b/Projections/Windows/Windows.csproj index c2c5616fa..a99feca2e 100644 --- a/Projections/Windows/Windows.csproj +++ b/Projections/Windows/Windows.csproj @@ -33,14 +33,14 @@ high - $(IntermediateOutputPath)cswinrt_windows.rsp + $(GeneratedFilesDir)cswinrt_windows.rsp $(CsWinrtExe) %40"$(CsWinRTResponseFile)" -verbose -in 10.0.18362.0 --out "$(IntermediateOutputPath)Generated Files" +-out "$(GeneratedFilesDir.TrimEnd('\'))" -include Windows # Exclude causality types colliding with those in System.Private.CoreLib.dll -exclude Windows.Foundation.Diagnostics @@ -61,7 +61,7 @@ -include Windows.UI.Xaml.Media.Animation.ConditionallyIndependentlyAnimatableAttribute - + @@ -69,7 +69,7 @@ - + diff --git a/README.md b/README.md index aab758b26..a7a395870 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,9 @@ C#/WinRT currently requires the following packages to build: The build.cmd script takes care of all related configuration steps and is the simplest way to get started building C#/WinRT. The build script is intended to be executed from a Visual Studio Developer command prompt. It installs prerequisites such as nuget and the .NET 5 SDK, configures the environment to use .NET 5 (creating a global.json if necessary), builds the compiler, and builds and executes the unit tests. -After a successful command-line build, the cswinrt.sln can be launched from the same command prompt, to inherit the necessary environment. By default, the UnitTest and WinUIProjection projections are only generated for Release configurations, where cswinrt.exe can execute in seconds. For Debug configurations, projection generation must be turned on with the project property GenerateTestProjection. +After a successful command-line build, the cswinrt.sln can be launched from the same command prompt, to inherit the necessary environment. + +**Note:** By default, projection projects only generate source files for Release configurations, where cswinrt.exe can execute in seconds. To generate projection sources for Debug configurations, set the project property GenerateTestProjection to 'true'. In either case, existing projection sources under the "Generated Files" folder will still be compiled into the projection assembly. This configuration permits a faster inner loop in Visual Studio. # Structure The C#/WinRT compiler and unit tests are all contained within the Visual Studio 2019 solution file, \cswinrt\cswinrt.sln. diff --git a/build.cmd b/build.cmd index c9d76dcae..3edae3b61 100644 --- a/build.cmd +++ b/build.cmd @@ -72,7 +72,7 @@ rem Generate prerelease targets file to exercise build warnings set prerelease_targets=nuget\Microsoft.Windows.CsWinRT.Prerelease.targets if not exist %prerelease_targets% ( echo Creating default %prerelease_targets% - echo ^ > %prerelease_targets% + echo ^ > %prerelease_targets% echo ^> %prerelease_targets% echo ^Condition="'$(Net5SdkVersion)' ^!= '%CsWinRTNet5SdkVersion%' or '$(MSBuildVersion)' ^!= '%CsWinRTMSBuildVersion%'"^> >> %prerelease_targets% echo ^ >> %prerelease_targets% diff --git a/nuget/Microsoft.Windows.CsWinRT.targets b/nuget/Microsoft.Windows.CsWinRT.targets index c446b8c2d..44a588ab5 100644 --- a/nuget/Microsoft.Windows.CsWinRT.targets +++ b/nuget/Microsoft.Windows.CsWinRT.targets @@ -5,10 +5,12 @@ Copyright (C) Microsoft Corporation. All rights reserved. --> - + $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', 'Generated Files')) $(ResolveAssemblyReferencesDependsOn);RemoveWindowsReference + +