|
74 | 74 | <ProjectCapability Include="Apple" /> |
75 | 75 | <ProjectCapability Include="Mobile" /> |
76 | 76 | <ProjectCapability Include="RuntimeEnvironmentVariableSupport" /> |
| 77 | + <!-- We have to use a network connection (web sockets) to connect hot reload / dotnet watch when running on device, so enable that. Since this also works locally (simulator/desktop), just enable it always --> |
| 78 | + <ProjectCapability Include="HotReloadWebSockets" /> |
77 | 79 |
|
78 | 80 | <ProjectCapability Include="IOSApplication" Condition="'$(_ProjectType)' == 'iOSExecutableProject'" /> |
79 | 81 | <ProjectCapability Include="IOSAppExtension" Condition="'$(_ProjectType)' == 'iOSAppExtensionProject'" /> |
|
471 | 473 | </ItemGroup> |
472 | 474 | </Target> |
473 | 475 |
|
474 | | - <Target Name="_ComputeMonoLibraries" Condition="'$(UseMonoRuntime)' == 'true'" DependsOnTargets="_ComputeMonoComponents;_MonoSelectRuntimeComponents"> |
| 476 | + <Target Name="_ComputeMonoLibraries" Condition="'$(UseMonoRuntime)' == 'true' And '$(RuntimeIdentifiers)' == ''" DependsOnTargets="_ComputeMonoComponents;_MonoSelectRuntimeComponents"> |
475 | 477 | <!-- We only include any mono components when linking with mono statically. The components are already included in the dynamic versions of Mono (both the dylib and the framework) --> |
476 | 478 | <ItemGroup Condition="'$(_LibMonoLinkMode)' == 'static'"> |
477 | 479 | <!-- Remove files mono told us not to link with --> |
@@ -2672,8 +2674,38 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B |
2672 | 2674 | </ItemGroup> |
2673 | 2675 | </Target> |
2674 | 2676 |
|
| 2677 | + <!-- |
| 2678 | + Validate that the build configuration will work for Hot Reload. |
| 2679 | + This target is executed when doing 'dotnet run' |
| 2680 | + --> |
| 2681 | + <Target Name="_ValidateHotReloadConfiguration"> |
| 2682 | + <ItemGroup> |
| 2683 | + <_HotReloadVariable Include="@(RuntimeEnvironmentVariable)" Condition="'%(Identity)' == 'DOTNET_WATCH' And '%(Value)' == '1'" /> |
| 2684 | + </ItemGroup> |
| 2685 | + <PropertyGroup Condition="@(_HotReloadVariable->Count()) > 0"> |
| 2686 | + <_IsHotReloadLaunch>true</_IsHotReloadLaunch> |
| 2687 | + </PropertyGroup> |
| 2688 | + |
| 2689 | + <Error |
| 2690 | + Condition="'$(_IsHotReloadLaunch)' == 'true' And '$(UseMonoRuntime)' == 'true' And '$(MtouchInterpreter)' == ''" |
| 2691 | + Text="Can't use Hot Reload or 'dotnet watch' unless the interpreter is enabled. Set 'UseInterpreter=true' in the project file to use the interpreter." |
| 2692 | + /> |
| 2693 | + <Error |
| 2694 | + Condition="'$(_IsHotReloadLaunch)' == 'true' And '$(_AreAnyAssembliesTrimmed)' == 'true'" |
| 2695 | + Text="Can't use Hot Reload or 'dotnet watch' if any assemblies are trimmed. Set 'MtouchLink=None' in the project file to disable trimming." |
| 2696 | + /> |
| 2697 | + </Target> |
| 2698 | + |
2675 | 2699 | <!-- Import existing targets --> |
2676 | 2700 |
|
| 2701 | + <!-- Make sure post-processing only includes dynamic frameworks that will actually be in the app bundle. Ref: https://github.com/dotnet/macios/issues/24840 --> |
| 2702 | + <PropertyGroup> |
| 2703 | + <_CollectItemsForPostProcessingDependsOn> |
| 2704 | + _ComputeFrameworkFilesToPublish; |
| 2705 | + $(_CollectItemsForPostProcessingDependsOn); |
| 2706 | + </_CollectItemsForPostProcessingDependsOn> |
| 2707 | + </PropertyGroup> |
| 2708 | + |
2677 | 2709 | <PropertyGroup> |
2678 | 2710 | <_ProjectLanguage>$(Language)</_ProjectLanguage> |
2679 | 2711 | <_ProjectLanguage Condition="'$(_ProjectLanguage)' == '' Or '$(_ProjectLanguage)' == 'C#' ">CSharp</_ProjectLanguage> |
|
0 commit comments