0

所以我有一个大约 2 岁的应用程序,运行良好。但是我最近在使用 Xamarin Studio 时遇到了很多问题,所以我在 Visual Studio for Mac 中完全重新构建了这个解决方案。一切都很好,大约 2 天,然后突然发生了一些奇怪的事情。出乎意料的是,我的 iPhone 配置消失了,不再可供我选择构建或在设置中查看。

如果我尝试创建一个新配置,它甚至没有给我选择 iPhone 作为平台的选项。它只显示 iPhoneSimulator。但是如果我一起创建一个新的空白解决方案,则默认配置中同时包含 iPhoneSimulator 和 iPhone。这个新的空白解决方案允许我添加 iPhone 平台的配置。

这是我尝试创建新配置时看到的内容,请注意它甚至没有为我提供 iPhone 作为配置,只有 iPhoneSimulator 在此处输入图像描述

如果我创建一个新的空白解决方案,它会为我提供 iPhone 作为选项在此处输入图像描述

请参阅下文了解我的解决方案文件和结构的外观:

在此处输入图像描述

以下是我的解决方案文件和解决方案/项目结构:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MobileClient.iOS", "MobileClient.iOS\MobileClient.iOS.csproj", "{7EEC6C4F-036E-4144-BBE9-6C01BECEA311}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Mobile.API", "..\xamarin_mobile_api\Mobile.API.shproj", "{4520CB09-DBCB-4764-8E8C-4CBAA2CBAD6A}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Mobile.iOS", "..\xamarin_mobile_ios\Mobile.iOS.shproj", "{10B1EF5A-0F37-4544-9327-902022A42BA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdjustBindingsiOS", "..\xamarin_mobile_api\3rdParty\Adjust\AdjustBindingsiOS\AdjustBindingsiOS.csproj", "{EF829C6D-7D00-4DF1-95C7-F3E54B164827}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mixpanel", "..\xamarin_mobile_api\3rdParty\Mixpanel\Mixpanel.csproj", "{5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|iPhoneSimulator = Debug|iPhoneSimulator
        Staging|iPhoneSimulator = Staging|iPhoneSimulator
        Production|iPhoneSimulator = Production|iPhoneSimulator
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Staging|iPhoneSimulator.ActiveCfg = Staging|iPhoneSimulator
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Staging|iPhoneSimulator.Build.0 = Staging|iPhoneSimulator
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Production|iPhoneSimulator.ActiveCfg = Production|iPhoneSimulator
        {7EEC6C4F-036E-4144-BBE9-6C01BECEA311}.Production|iPhoneSimulator.Build.0 = Production|iPhoneSimulator
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Staging|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Staging|iPhoneSimulator.Build.0 = Debug|Any CPU
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Production|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {EF829C6D-7D00-4DF1-95C7-F3E54B164827}.Production|iPhoneSimulator.Build.0 = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Staging|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Staging|iPhoneSimulator.Build.0 = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Production|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {5E6FA2B8-D94C-4318-8A37-1E9D765CF71E}.Production|iPhoneSimulator.Build.0 = Debug|Any CPU
    EndGlobalSection
    GlobalSection(MonoDevelopProperties) = preSolution
        Policies = $0
        $0.TextStylePolicy = $1
        $1.inheritsSet = null
        $1.scope = application/vnd.apple-interface-builder
        $1.inheritsScope = text/plain
        $1.FileWidth = 120
        $1.TabsToSpaces = False
        $0.CSharpFormattingPolicy = $2
        $2.IndentSwitchBody = True
        $2.IndentCaseBody = False
        $2.IndentPreprocessorDirectives = False
        $2.AnonymousMethodBraceStyle = NextLine
        $2.PropertyGetBraceStyle = NextLine
        $2.PropertySetBraceStyle = NextLine
        $2.EventBraceStyle = NextLine
        $2.EventAddBraceStyle = NextLine
        $2.EventRemoveBraceStyle = NextLine
        $2.StatementBraceStyle = NextLine
        $2.ElseNewLinePlacement = NewLine
        $2.ElseIfNewLinePlacement = DoNotCare
        $2.WithinMethodDeclarationParentheses = True
        $2.AfterDelegateDeclarationParameterComma = True
        $2.scope = text/x-csharp
        $0.DotNetNamingPolicy = $3
        $0.TextStylePolicy = $4
        $4.inheritsSet = null
        $4.scope = application/config+xml
        $0.XmlFormattingPolicy = $5
        $5.inheritsSet = null
        $5.scope = application/vnd.apple-interface-builder
        $5.inheritsScope = application/xml
        $0.TextStylePolicy = $6
        $6.inheritsSet = null
        $6.scope = application/xml
        $0.XmlFormattingPolicy = $7
        $7.scope = application/xml
        $0.TextStylePolicy = $8
        $8.scope = text/plain
        $0.TextStylePolicy = $9
        $9.inheritsSet = null
        $9.scope = application/json
        $0.VersionControlPolicy = $10
        $0.TextStylePolicy = $11
        $11.inheritsSet = null
        $11.scope = application/vnd.apple-xcode-storyboard
        $0.XmlFormattingPolicy = $12
        $12.inheritsSet = null
        $12.scope = application/vnd.apple-xcode-storyboard
        $0.TextStylePolicy = $13
        $13.inheritsSet = null
        $13.scope = application/vnd.apple-interface-builder
        $0.XmlFormattingPolicy = $14
        $14.inheritsSet = null
        $14.scope = application/vnd.apple-interface-builder
        $0.StandardHeader = $15
    EndGlobalSection
EndGlobal

只是为了测试,我在 Visual Studio for Mac 中从头开始创建了一个新的空白 iOS 解决方案。下面是该解决方案文件的样子。

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asdfasdf", "asdfasdf\asdfasdf.csproj", "{398E03FF-50ED-4D8C-8845-A6077EFF0093}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qweradfsxz", "qweradfsxz\qweradfsxz.csproj", "{ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|iPhoneSimulator = Debug|iPhoneSimulator
        Release|iPhone = Release|iPhone
        Release|iPhoneSimulator = Release|iPhoneSimulator
        Debug|iPhone = Debug|iPhone
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Release|iPhone.ActiveCfg = Release|iPhone
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Release|iPhone.Build.0 = Release|iPhone
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Debug|iPhone.ActiveCfg = Debug|iPhone
        {398E03FF-50ED-4D8C-8845-A6077EFF0093}.Debug|iPhone.Build.0 = Debug|iPhone
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Release|iPhone.ActiveCfg = Release|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Release|iPhone.Build.0 = Release|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Debug|iPhone.ActiveCfg = Debug|Any CPU
        {ABB95F3F-67FA-48D4-89AB-8EAD30C69DE2}.Debug|iPhone.Build.0 = Debug|Any CPU
    EndGlobalSection
EndGlobal

以下是我的解决方案的构建目标平台选项的屏幕截图。注意 iPhone 部署目标消失了。而在配置映射中,iPhone 平台消失了,iPhoneSimulator 是唯一可用的。

在此处输入图像描述在此处输入图像描述

下面是我制作的测试解决方案的屏幕截图,请注意在配置映射中有一个 iPhone(我的手机名称是 LeetSauce)选项以及一个 iPhone 选项。

在此处输入图像描述在此处输入图像描述

任何想法我如何打破这个或如何解决它?

- - - - - - - - - 编辑 - - - - - - - - -

因此,Xamarin 论坛上的一位用户向我展示了您可以在第一个屏幕截图的平台框中手动输入“iPhone”。那很有帮助。但我最终只是重新创建了解决方案并再次添加了所有文件/资源​​/包/组件。我无法再次重现该问题,希望我不再看到它。这“感觉”就像我的 .sln 和/或 .csproj 文件以某种方式损坏的错误。它也有可能一开始就坏了,它工作了 2 天只是侥幸。希望不要再发生了。

4

1 回答 1

1

我认为对此的快速解决方案会创建一个新解决方案并创建与旧项目同名的新项目。您不需要向每个项目添加文件。

然后从新项目复制所有配置设置并粘贴到旧项目并替换 GUID。

于 2017-05-24T05:00:45.650 回答