Skip to content

Commit

Permalink
preview: Add WinUI3XPLaunchProject config #15
Browse files Browse the repository at this point in the history
  • Loading branch information
roxk committed Apr 20, 2024
1 parent bfe79d0 commit a8cf16a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
8 changes: 8 additions & 0 deletions WinUI3XamlPreview/Nuget/WinUI3XamlPreview-Native.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)..\WinUI3XamlPreviewRules.Project.xml"/>
<ProjectCapability Include="WinUI3XP" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions WinUI3XamlPreview/Nuget/WinUI3XamlPreview.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<files>
<file src="..\..\README.md"/>
<file src="..\..\LICENSE"/>
<file target="build\WinUI3XamlPreviewRules.Project.xml" src="WinUI3XamlPreviewRules.Project.xml"/>

<!-- Ref: https://docs.microsoft.com/en-us/nuget/guides/create-uwp-packages -->
<!-- Note: Only WinRT stuff use namespace as file name, i.e. winmd and pri -->
Expand All @@ -39,7 +40,9 @@
<file target="runtimes\win-x64\native\WinUI3XamlPreview.dll" src="..\x64\Release\WinUI3XamlPreview\WinUI3XamlPreview.dll" />
<file target="runtimes\win-x64\native" src="..\x64\Release\WinUI3XamlPreview\WinUI3XamlPreview.pri" />

<file target="build\WinUI3XamlPreview.props" src="WinUI3XamlPreview.props"/>
<file target="build\WinUI3XamlPreview.targets" src="WinUI3XamlPreview.targets"/>
<file target="build\native\WinUI3XamlPreview.props" src="WinUI3XamlPreview-Native.props"/>
<file target="build\native\WinUI3XamlPreview.targets" src="WinUI3XamlPreview-Native.targets"/>

<!-- .NET projection -->
Expand Down
8 changes: 8 additions & 0 deletions WinUI3XamlPreview/Nuget/WinUI3XamlPreview.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)WinUI3XamlPreviewRules.Project.xml"/>
<ProjectCapability Include="WinUI3XP" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions WinUI3XamlPreview/Nuget/WinUI3XamlPreviewRules.Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Rule Name="WinUI3XP" DisplayName="WinUI3XamlPreview" Order="75" PageTemplate="generic" xmlns="http://schemas.microsoft.com/build/2009/properties">

<Rule.Categories>
<Category Name="General" DisplayName="General"/>
</Rule.Categories>

<Rule.DataSource>
<DataSource Persistence="ProjectFile" HasConfigurationCondition="false" Label="Globals" />
</Rule.DataSource>

<BoolProperty Name="WinUI3XPEnabled"
DisplayName="Enable WinUI3XamlPreview"
Description="Enable WinUI3XamlPreview. Default is true."
Category="General" />

<StringProperty Name="WinUI3XPLaunchProject"
DisplayName="Launch Project"
Description="Name of the project to launch for previewing this project's XAML. Useful for DLL or WAP projects."
Category="General" />

</Rule>
8 changes: 5 additions & 3 deletions WinUI3XamlPreview/TestNuget/TestNuget.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.props" Condition="Exists('..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.props')" />
<Import Project="..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.props" Condition="Exists('..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.props')" />
<Import Project="..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.755\build\Microsoft.Windows.SDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.755\build\Microsoft.Windows.SDK.BuildTools.props')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" />
Expand Down Expand Up @@ -231,9 +232,10 @@
<Error Condition="!Exists('..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.WindowsAppSDK.1.4.230913002\build\native\Microsoft.WindowsAppSDK.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220914.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.props'))" />
<Error Condition="!Exists('..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinUI3XamlPreview.0.0.0\build\native\WinUI3XamlPreview.targets'))" />
</Target>
<Target Name="EnsureLocalPackage" BeforeTargets="EnsureNuGetPackageBuildImports">
<Exec Command="powershell -c &quot;if (test-path $(ProjectDir)..\LocalPackages\WinUI3XamlPreview.0.0.0.nupkg) { nuget restore $(ProjectPath) -PackagesDirectory $(ProjectDir)..\packages; exit 0 }; $(ProjectDir)..\scripts\build-nuget -version 0.0.0; move $(ProjectDir)..\Nuget\WinUI3XamlPreview.0.0.0.nupkg -destination $(ProjectDir)..\LocalPackages\WinUI3XamlPreview.0.0.0.nupkg; nuget restore $(ProjectPath) -PackagesDirectory $(ProjectDir)..\packages&quot;" />
</Target>
<Target Name="EnsureLocalPackage" BeforeTargets="EnsureNuGetPackageBuildImports">
<Exec Command="powershell -c &quot;if (test-path $(ProjectDir)..\LocalPackages\WinUI3XamlPreview.0.0.0.nupkg) { nuget restore $(ProjectPath) -PackagesDirectory $(ProjectDir)..\packages; exit 0 }; $(ProjectDir)..\scripts\build-nuget -version 0.0.0; move $(ProjectDir)..\Nuget\WinUI3XamlPreview.0.0.0.nupkg -destination $(ProjectDir)..\LocalPackages\WinUI3XamlPreview.0.0.0.nupkg; nuget restore $(ProjectPath) -PackagesDirectory $(ProjectDir)..\packages&quot;" />
</Target>
</Project>

0 comments on commit a8cf16a

Please sign in to comment.