[msbuild] Show proper build error when monotouch.dll doesn't exist (#750)

Due to the deprecation of classic we needed to provide a better and single error message
rather than the countless msbuild errors you'd have because you'd be missing monotouch.dll

* Migrate MySingleView & MyLibrary to Unified
This commit is contained in:
Vincent Dondain 2016-09-06 20:50:54 +02:00 коммит произвёл Sebastien Pouliot
Родитель 861bfe4f9e
Коммит 562b9564f1
11 изменённых файлов: 44 добавлений и 28 удалений

Просмотреть файл

@ -536,6 +536,9 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
</Target> </Target>
<Target Name="_DetectSdkLocations" DependsOnTargets="_ComputeTargetArchitectures"> <Target Name="_DetectSdkLocations" DependsOnTargets="_ComputeTargetArchitectures">
<Error Text="Support for Classic applications (using monotouch.dll) is obsoleted in Xamarin.iOS 10.0+. Please migrate your project to Unified (Project > Migrate to Xamarin.iOS Unified API)."
Condition="'$(TargetFrameworkIdentifier)' == 'MonoTouch' And !Exists('$(MonoTouchSdkRoot)/lib/mono/2.1/monotouch.dll')"/>
<DetectSdkLocations <DetectSdkLocations
SessionId="$(BuildSessionId)" SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'" Condition="'$(IsMacEnabled)' == 'true'"

Просмотреть файл

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MonoTouch.Foundation; using Foundation;
using MonoTouch.UIKit; using UIKit;
namespace MySingleView namespace MySingleView
{ {

Просмотреть файл

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MonoTouch.Foundation; using Foundation;
using MonoTouch.UIKit; using UIKit;
using MyLibrary; using MyLibrary;
namespace MySingleView namespace MySingleView

Просмотреть файл

@ -6,11 +6,13 @@
<ProductVersion>10.0.0</ProductVersion> <ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{93788F78-16E5-432F-89D8-30F041C51974}</ProjectGuid> <ProjectGuid>{93788F78-16E5-432F-89D8-30F041C51974}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>MyLibrary</RootNamespace> <RootNamespace>MyLibrary</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>MyLibrary</AssemblyName> <AssemblyName>MyLibrary</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -34,13 +36,12 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="monotouch" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Resources\" /> <Folder Include="Resources\" />
<Folder Include="MyLibraryFolder\" /> <Folder Include="MyLibraryFolder\" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\..\Xamarin.iOS.Tasks\bin\Debug\Xamarin.MonoTouch.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Compile Include="TestFoo.cs" /> <Compile Include="TestFoo.cs" />
</ItemGroup> </ItemGroup>
@ -66,4 +67,5 @@
<InterfaceDefinition Include="LibraryStoryboard.storyboard" /> <InterfaceDefinition Include="LibraryStoryboard.storyboard" />
<InterfaceDefinition Include="LibrarySecondStoryboard.storyboard" /> <InterfaceDefinition Include="LibrarySecondStoryboard.storyboard" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project> </Project>

Просмотреть файл

@ -6,11 +6,13 @@
<ProductVersion>8.0.30703</ProductVersion> <ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}</ProjectGuid> <ProjectGuid>{8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>MySingleView</RootNamespace> <RootNamespace>MySingleView</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>MySingleView</AssemblyName> <AssemblyName>MySingleView</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -47,6 +49,7 @@
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7</MtouchArch>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>full</DebugType> <DebugType>full</DebugType>
@ -57,6 +60,7 @@
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>full</DebugType> <DebugType>full</DebugType>
@ -69,6 +73,7 @@
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<CodesignProvision>Automatic:AdHoc</CodesignProvision> <CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>full</DebugType> <DebugType>full</DebugType>
@ -80,12 +85,13 @@
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<CodesignProvision>Automatic:AppStore</CodesignProvision> <CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="monotouch" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Resources\" /> <Folder Include="Resources\" />
@ -106,7 +112,6 @@
<DependentUpon>MySingleViewViewController.cs</DependentUpon> <DependentUpon>MySingleViewViewController.cs</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<Import Project="..\..\Xamarin.iOS.Tasks\bin\Debug\Xamarin.MonoTouch.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="MyLibrary\MyLibrary.csproj"> <ProjectReference Include="MyLibrary\MyLibrary.csproj">
<Project>{93788F78-16E5-432F-89D8-30F041C51974}</Project> <Project>{93788F78-16E5-432F-89D8-30F041C51974}</Project>
@ -167,4 +172,5 @@
<AtlasTexture Include="Resources\Archer\Archer_Attack.atlas\archer_attack_0009.png" /> <AtlasTexture Include="Resources\Archer\Archer_Attack.atlas\archer_attack_0009.png" />
<AtlasTexture Include="Resources\Archer\Archer_Attack.atlas\archer_attack_0010.png" /> <AtlasTexture Include="Resources\Archer\Archer_Attack.atlas\archer_attack_0010.png" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project> </Project>

Просмотреть файл

@ -1,7 +1,7 @@
using System; using System;
using System.Drawing; using CoreGraphics;
using MonoTouch.Foundation; using Foundation;
using MonoTouch.UIKit; using UIKit;
namespace MySingleView namespace MySingleView
{ {

Просмотреть файл

@ -3,7 +3,7 @@
// actions made in the Xcode designer. If it is removed, they will be lost. // actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly. // Manual changes to this file may not be handled correctly.
// //
using MonoTouch.Foundation; using Foundation;
namespace MySingleView namespace MySingleView
{ {

Просмотреть файл

@ -13,10 +13,11 @@ namespace Xamarin.iOS.Tasks
{ {
Platform = platform; Platform = platform;
} }
[Test] [Test]
public void BuildTest () public void BuildTest ()
{ {
var mtouchPaths = SetupProjectPaths ("bindings-test", "../../../tests/", false, Platform); var mtouchPaths = SetupProjectPaths ("bindings-test", "bindings-test-unified", "../../../tests/", false, Platform, "Any CPU/Debug-unified");
var proj = SetupProject (Engine, mtouchPaths ["project_csprojpath"]); var proj = SetupProject (Engine, mtouchPaths ["project_csprojpath"]);
@ -36,7 +37,7 @@ namespace Xamarin.iOS.Tasks
[Test] [Test]
public void FrameworkTest () public void FrameworkTest ()
{ {
var mtouchPaths = SetupProjectPaths ("bindings-test", "../../../tests/", false, Platform); var mtouchPaths = SetupProjectPaths ("bindings-test", "bindings-test-unified", "../../../tests/", false, Platform, "Any CPU/Debug-unified");
var proj = SetupProject (Engine, mtouchPaths ["project_csprojpath"]); var proj = SetupProject (Engine, mtouchPaths ["project_csprojpath"]);
AppBundlePath = mtouchPaths.AppBundlePath; AppBundlePath = mtouchPaths.AppBundlePath;

Просмотреть файл

@ -26,7 +26,7 @@ namespace Xamarin.iOS.Tasks {
{ {
var mtouchPaths = SetupProjectPaths ("MyWatchApp", platform: Platform); var mtouchPaths = SetupProjectPaths ("MyWatchApp", platform: Platform);
using (var xiproj = XIProject.Clone (mtouchPaths.ProjectPath, "MyWatchKitExtension", "MyWatchKitApp")) { using (var xiproj = XIProject.Clone (mtouchPaths.ProjectPath, "MyWatchKitExtension", "MyWatchKitApp")) {
mtouchPaths = SetupProjectPaths ("MyWatchApp", xiproj.ProjectDirectory, platform: Platform); mtouchPaths = SetupProjectPaths ("MyWatchApp", "MyWatchApp", xiproj.ProjectDirectory, platform: Platform);
var appInfoPath = Path.Combine (mtouchPaths.ProjectPath, "Info.plist"); var appInfoPath = Path.Combine (mtouchPaths.ProjectPath, "Info.plist");
var appInfoContents = File.ReadAllText (appInfoPath); var appInfoContents = File.ReadAllText (appInfoPath);

Просмотреть файл

@ -79,8 +79,8 @@ namespace Xamarin.iOS.Tasks
"System.Xml.dll.mdb", "System.Xml.dll.mdb",
"System.dll", "System.dll",
"System.dll.mdb", "System.dll.mdb",
"monotouch.dll", "Xamarin.iOS.dll",
"monotouch.dll.mdb", "Xamarin.iOS.dll.mdb",
"mscorlib.dll", "mscorlib.dll",
"mscorlib.dll.mdb", "mscorlib.dll.mdb",
"runtime-options.plist", "runtime-options.plist",
@ -145,7 +145,7 @@ namespace Xamarin.iOS.Tasks
Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#3b"); Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#3b");
Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#3c"); Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#3c");
Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#3d"); Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#3d");
Assert.IsTrue (references.Any (t => t.Include.Contains ("monotouch")), "#3e"); Assert.IsTrue (references.Any (t => t.Include.Contains ("Xamarin.iOS")), "#3e");
} }
[Test] [Test]
@ -155,12 +155,11 @@ namespace Xamarin.iOS.Tasks
var references = LibraryProject.GetEvaluatedItemsByName ("ReferencePath").ToArray (); var references = LibraryProject.GetEvaluatedItemsByName ("ReferencePath").ToArray ();
Assert.AreEqual (5, references.Length, "#1"); Assert.AreEqual (5, references.Length, "#1");
Assert.IsTrue (references.All (t => t.Include.Contains ("2.1")), "#2"); Assert.IsTrue (references.Any (t => t.Include.Contains ("System")), "#2a");
Assert.IsTrue (references.Any (t => t.Include.Contains ("System")), "#3a"); Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#2b");
Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#3b"); Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#2c");
Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#3c"); Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#2d");
Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#3d"); Assert.IsTrue (references.Any (t => t.Include.Contains ("Xamarin.iOS")), "#2e");
Assert.IsTrue (references.Any (t => t.Include.Contains ("monotouch")), "#3e");
} }
[Test] [Test]

Просмотреть файл

@ -92,7 +92,7 @@ namespace Xamarin.iOS.Tasks
get; set; get; set;
} }
public ProjectPaths SetupProjectPaths (string projectName, string baseDir = "../", bool includePlatform = true, string platform = "iPhoneSimulator", string config = "Debug") public ProjectPaths SetupProjectPaths (string projectName, string csprojName, string baseDir = "../", bool includePlatform = true, string platform = "iPhoneSimulator", string config = "Debug")
{ {
var projectPath = Path.Combine(baseDir, projectName); var projectPath = Path.Combine(baseDir, projectName);
@ -103,11 +103,16 @@ namespace Xamarin.iOS.Tasks
ProjectPath = projectPath, ProjectPath = projectPath,
ProjectBinPath = binPath, ProjectBinPath = binPath,
ProjectObjPath = objPath, ProjectObjPath = objPath,
ProjectCSProjPath = Path.Combine (projectPath, projectName + ".csproj"), ProjectCSProjPath = Path.Combine (projectPath, csprojName + ".csproj"),
AppBundlePath = Path.Combine (binPath, projectName + ".app"), AppBundlePath = Path.Combine (binPath, projectName + ".app"),
}; };
} }
public ProjectPaths SetupProjectPaths (string projectName, string baseDir = "../", bool includePlatform = true, string platform = "iPhoneSimulator", string config = "Debug")
{
return SetupProjectPaths (projectName, projectName, baseDir, includePlatform, platform, config);
}
[SetUp] [SetUp]
public virtual void Setup () public virtual void Setup ()
{ {