Skip to content

Commit fce6773

Browse files
committed
fix: Ensure Xamarin.iOS target is deployable when Mac Host is connected
1 parent b118ce1 commit fce6773

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/SolutionTemplate/UnoSolutionTemplate.Wizard.2019/UnoSolutionWizard.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void RunFinished()
6565
OpenWelcomePage();
6666
SetStartupProject();
6767
SetUWPAnyCPUBuildableAndDeployable();
68+
SetiOSDeployable();
6869
SetDefaultConfiguration();
6970
}
7071

@@ -183,17 +184,48 @@ private void SetUWPAnyCPUBuildableAndDeployable()
183184
}
184185
}
185186

187+
private void SetiOSDeployable()
188+
{
189+
if (_dte?.Solution.SolutionBuild is SolutionBuild val)
190+
{
191+
try
192+
{
193+
var iOSConfigs = new[] {
194+
GetSolutionConfiguration(val, "Debug", "iPhone"),
195+
GetSolutionConfiguration(val, "Debug", "iPhoneSimulator")
196+
}.Select(c => c.SolutionContexts);
197+
198+
foreach (SolutionConfiguration solutionConfiguration2 in val.SolutionConfigurations)
199+
{
200+
foreach (var iOSSolutionContext in iOSConfigs)
201+
{
202+
var iOSProject = iOSSolutionContext
203+
.Cast<SolutionContext>()
204+
.FirstOrDefault(c => c.ProjectName.EndsWith(".iOS.csproj"));
205+
if (iOSProject != null)
206+
{
207+
iOSProject.ShouldDeploy = true;
208+
}
209+
}
210+
}
211+
}
212+
catch (Exception)
213+
{
214+
}
215+
}
216+
}
217+
186218
private void SetDefaultConfiguration()
187219
{
188220
try
189221
{
190222
if (_dte?.Solution.SolutionBuild is SolutionBuild2 val)
191223
{
192-
var x86Config = val.SolutionConfigurations
193-
.Cast<SolutionConfiguration2>()
194-
.FirstOrDefault(c => c.Name == "Debug" && c.PlatformName == "x86");
224+
var x86Config = val.SolutionConfigurations
225+
.Cast<SolutionConfiguration2>()
226+
.FirstOrDefault(c => c.Name == "Debug" && c.PlatformName == "x86");
195227

196-
x86Config?.Activate();
228+
x86Config?.Activate();
197229
}
198230
else
199231
{

0 commit comments

Comments
 (0)