How to Set Up Xamarin.Forms for MacOS Sierra? - visual-studio

Visual Studio seems to be having a hard time starting up, so I'm wondering if there's anything wrong in my setting it up. I'm currently using:
macOS Sierra, version 10.12.6
Visual Studio (VS) for Mac (Community edition), version 7.3.2 (build 12)
Setting up New Solution:
A (New Project):
select Multiplatform App
under Xamarin.Forms, select Blank Forms App (C#)
select Next
B (Configure your Blank Forms App, part 1):
App Name: ABCD
Organizer Identifier: com.WXYZ
Target Platforms: select both Android and iOS
Shared Code: select Use Portable Class Library and Use XAML for user interface files
select Next
C (Configure your Blank Forms App, part 2):
Project Name: ABCD
Solution Name: ABCD
Location: [choose location], select Create a project directory within the solution directory.
Version Control: select nothing
Xamarin Test Cloud: select nothing
select Create
Immediately, VS begins the Adding packages... process. After it's done, the 3 Packages folders have a variety of Xamarin-related files, one of which they all have in common: Xamarin.Forms.
Just as a test, I right-click on ABCD solution folder and select Clean ABCD. Immediately, I get hit with this:
Error XF001: Xamarin.Forms targets have been imported multiple times.
Please check your project file and remove the duplicate import(s).
(XF001) (ABCD)
Why is this happening? I've tried separately deleting each of the Xamarin.Forms file in each of the aforementioned 3 Packages folders, but that did nothing good.
Right-clicking on the error message and selecting Show Error Reference literally just takes me to a Google Search result page for the search term "XF001", which helps 0%.
What am I doing wrong?

I have encountered this as well. It seems like a bug in the current 'New Project' templates, at least in Visual Studio for Mac.
Go into the folder where the csproj file of your shared library is. edit it with Notepad or similar and find the <import> node(s) at the bottom. There should be one which has something relatable to Xamarin in it. Remove this import node, save it and open/reload your solution.

Nuget might generate (for some reason) .nuget.targets and .nuget.props files in the project directory containing Import statements for Xamarin.Forms in addition to the same Import statements in the project file (<project>.csproj).
Backup the .nuget.targets and/or .nuget.props files and try removing the .nuget.targets and .nuget.props files from the project directory.

Related

File path broken in Xcode. (lots of ../../../../) [duplicate]

I am not sure if it is related with beta software I am using.
I've recorded a video which shows the problem:
https://youtu.be/AuxjNpylaMc
When I create new files in Xcode, they're put in super weird location which causes a lot of problems when pushing files to repository.
When I create a file in Xcode (no matter where in project, no matter which project I am loaded into, no matter where is the project located on my drive) this is how the relative path is generated:
../../../../../../System/Volumes/Data/Users/patryksredzinski/Desktop/PerfTester/PerfTester-Xcode/PerfTester-Xcode/wtfTableViewCell.swift
I've found out a solution which is to move the file in xcode project navigator to another group, which will make a copy of the file with valid path. I can then remove old file and move back copied version.
Is it related with macOS beta 4 version? Did they broke something? Is there any way to fix it?
(these invalid paths cause the project to work only on my machine)
macOS Catalina 10.15 Beta (19A512f)
xcode Version 10.3 (10G8)
(tested also on Xcode 11 beta 4 and same issue)
I came across the same issue right after updating to macOS Catalina Beta 4 as well. Here is a workaround:
Navigate to the project file in Finder, right click the xcodeproj > Open With > Other... > Enable: All Applications > [text editor of choice]. Open up the project.pbxproj file.
Find the section named /* Begin PBXFileReference section */ and below it, locate the section where it says:
path = ../../../../../../System/Volumes/Data/Users/patryksredzinski/Desktop/PerfTester/PerfTester-Xcode/PerfTester-Xcode/wtfTableViewCell.swift
and replace it with path = wtfTableViewCell.swift.
Save the file. Xcode should reflect the changes you made. To check, navigate to the inspector panel, under Identity and Type > Location, the path should now only display the [filename].swift.
Hopefully a permanent fix will come out soon.

Xcode 10 Error: Multiple commands produce

error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':
1) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
2) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Server/Masonry/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
3) Target 'OptimalLive' has process command with input '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist'
Running the code in Xcode 9 works, but there is an error in Xcode 10.
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I found the solution for this build error, for anybody else having the same issue with Xcode 10 build system, follow the following steps to fix it:
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
It will resolve the build issue with the new Xcode 10.
If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.
Go to Xcode -> File ->Workspace Settings.
You will find one pop up like.
Select "Legacy Build System" from Build System tag.
Press on "Done"
Note:- Make sure clear your project with "cmd+shift+alt+k" and "Derived Data"
Build your project it will work charm :)
I was experimenting with Core Data. I built a data model for a simple checklist program and generated the NSManagedObjects. When I compiled the project I got the following error:
error: Multiple commands produce '/Users/myUSerName/Library/Developer/Xcode/DerivedData/myCoreDateExperiment-gzbslaqdwglkzxemijpdqmizgyzc/Build/Intermediates.noindex/ myCoreDateExperiment /Debug-iphonesimulator/ myCoreDateExperiment.build/Objects-normal/x86_64/CheckListItem+CoreDataProperties.o':
1) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
2) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
The problem was the data model (CheckList.xcdatamodeld in my case) was in the "Compile Sources" list. The project compiled cleanly when I removed it from the list.
Open the project navigator and select the project (very first entry at the top)
Select your build target under Targets in the "Projects and Targets" pane
Select Build Phases option near the top
Expand the "Compile Sources" entry and look for your data model name. Search for "xcdatamodeld" if you have trouble finding it.
Delete the model from the compile list
Make sure the data model is included in the "Copy Bundle Resources" list. Add it if it is missing.
EDIT
As #WilliamT. explains in the comments, you need the xcdatamodeld in the compile list. Instead, go to your entities within the xcdatamodeld file. Select the models that are erroring, expand the left panel, and change the field of "Codegen" to "Manual/None".
This answer is deprecated - XCode 12 has deprecated the Legacy Build System, it will be removed in a further release
Try this as well.
Xcode->File->Project Settings-> Build System -> Legacy Build System.
If you are getting this from the Ditto command creating multiple instances of the same name (NOT the 'copy files' build phase), you may have to change the Product Module Name.
Click on your Target(s) Xcode is complaining about
Click on Build Settings
Search for Product Module Name
Change the name to something unique
We have a watch target and a few notification targets in our app, so I just put things like Extension on the end of the module name.
I found this solution originally here: https://forums.developer.apple.com/thread/103913
If you use CocoaPods you may want to try deintegrate the pods and install again. It works for me.
pod deintegrate
pod install
While checking the build log, I noticed a warning:
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/<redacted>/Repositories/Whitesmith/optimize-ios/Carthage/Checkouts/WSStatusBarNotification/Miscellaneous/Info.plist'. (in target 'JDStatusBarNotification')
So, if that's your case then just go to your target:
Build Phases
Copy Bundle Resource
Remove info.plist.
Read this answer if error message references Core Data files
Synopsis: You may have both automatically-generated and manually-generated Core Data managed object class files.
This answer applies if the first line of the error refers to a Foo+CoreDataProperties.o or Foo+CoreDataClass.o file. Example:
error: Multiple commands produce '/Users/me/Library/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/ MyApp /Debug-iphonesimulator/ MyApp.build/Objects-normal/x86_64/Foo+CoreDataProperties.o':
1) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
2) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
The root cause can be seen by expanding the Compile Swift Source Files section of the Build Transcript. For example:
<unknown>:0: error: filename "Address+CoreDataClass.swift" used twice: '/Users/myUserName/Projects/Jnky/Foo+CoreDataProperties' and '/Users/jk/myUserName/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/MyApp.build/Debug/MyApp.build/DerivedSources/CoreDataGenerated/Jnky/Foo+CoreDataProperties.swift'
The first file mentioned there is a source file in your project directory, which someone generated by selecting your data model in the Project Navigator and clicking in the menu Editor > Create Managed Object Subclass. This feature was added in Xcode 7 or so.
The second file is a file of the same name but which is buried in Xcode's DerivedData. This file is generated automatically by Xcode during every build if the data model (.xcdatamodeld) file is included in the target's Compile Sources build phase. This feature was added in Xcode 9 or so. Zero, one or two files are generated for each entity/class, depending on the setting of the Codegen popup. That popup is in the Data Model Inspector when you select an entity while editing your data model…
The settings are:
Manual/None No files are generated
Category/Extension One file, Foo+CoreDataProperties.m or .swift is generated, containing an Objective-C category or Swift extension.
Class Definition That same Category/Extension file is generated, and in addition a Foo+CoreDataClass.m or .swift is generated, containing class declaration and definition.
So you see the problem occurs when a developer (like me) who is accustomed to the older Xcode begins a project in a newer Xcode. We think that we need to use the Create Managed Object Subclass menu item, which we do, to create the files we can see in the Project Navigator while not realizing that our settings in the Codegen popup are causing Xcode to create duplicate files, which Apple "cleverly" does not show in the Project Navigator, because they don't trust developers to read and heed the comment in the header // This file was automatically generated and should not be edited.
Solution 1 - Use the Older Way
You can disable all automatic Codegen for a data model with just one setting:
Open the problem Target's Build Phases (In Project Navigator, select project, then in list of TARGETS which appears, select the problem target, then tab Build Phases).
Expand the Compile Sources entry and find the problem data model (.xcdatamodeld file).
Delete it from the compile list
Ensure the data model is included in the Copy Bundle Resources list.
Solution 2 - Core Data Magic For Beginners
Here, you go all in on the newer way.
Leave your data model as is in that Compile Sources.
In each Entity Inspector in your data model, set Codegen to Class Definition.
In the Project Navigator, delete and trash any Foo+CoreDataClass files, and rename any Foo+CoreDataProperties.m or .swift files to something like Foo+MyProperties.
In each Foo+MyProperties.m or .swift file, if there are properties generated by Xcode, delete these properties because they will be in the hidden files created by Codegen.
With this solution, your class definitions are generated automatically from the data model on each build. You can't even see them. It is Core Data Magic, nice and simple for beginners.
Solution 3 - For Most Real-World Apps
But Solution 2 is no good if you really want to add non-managed properties. (Objective-C does not allow properties to be added in categories, and Swift does not allow stored properties to be added in extensions.) So in most real-world apps, you probably want to go halfway between Solutions 1 and 2…
Leave your data model in the list of Compile Sources
In each Entity Inspector in your data model, set Codegen to Category/Extension.
In the Project Navigator, delete and trash any Foo+CoreDataClass.m or .swift files, and, to reduce future confusion, rename any Foo+CoreDataProperties.m or .swift files to maybe just Foo.m or .swift.
Ensure that each Foo.m or .swift file contains the class definition, to which you can add your own non-managed properties.
(Acknowledgments to the answer by Positron. My answer here explains why Positron's answer (my Solution 1) works, and adds Solution 2 and Solution 3.)
Solution 1 :
Open target ➼ Build phases ➼ Copy Bundle Resources ➼ remove info.plist from there. ➼ you will have to remove the plist from the Extensions too (if any).
Solution 2:
If you use CocoaPods you may want to try deintegrate the pods and install again.
Commands:
1) pod deintegrate
2) pod install
Solution 3:
In Xcode, go to File ➼ Project/Workspace settings.
➼ Change the build system to Legacy Build system.
I had the same problem, I had a one more helper app in main App and copy this in resource. In my case solved as :-
1) Target -> 2)Build Phases 2) Copy File (n items) 3) Remove Copy File.
The Helper app automatically copied in Xcode 10.0.
Try this Its Working :
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
None of the solutions proposed here worked for me. This was particularly due to CocoaPods. I was previously using Cocoapods 1.3.1. Simply upgrading to 1.5.3 didn't resolve the issue right away.
The steps I followed were:
Delete Podfile.lock
Delete Pods directory
Delete Derived Data & Clean
Exit Xcode
Update CocoaPods to 1.5.3
Run pod install
Open workspace and build
One option which solved my issue is to changing build system to legacy build system. Please follow the following steps in Xcode 10+.
Here I have written a detailed article on the problem & its solution. Xcode Error: Multiple commands produce
In my case PDFGenerator was producing an info.plist file, I just deleted it.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I'm using Xcode 11.4
Can't build old project
Xcode => File => Project Settings => Build System => Legacy Build System
Before I begin note that my project utilizes Carthage as a dependency manager.
None of the existing answers here resolved my issue. What did resolve the issue for me was the following.
First, I noticed that the build error pointed out one framework in particular. Next I filtered App Target > Build Phases for that framework. I noticed that that framework was present in both "Link Binary With Libraries" and "Embed Frameworks". Noting that none of the frameworks listed under "Embed Frameworks" were ones managed by Carthage I removed the framework in question from "Embed Frameworks". I then re-built my project and everything works fine including the functionality enabled by the framework in question.
This issue arose for me after adding a second part of the Fabric suite of SDKs to the app.
What actually happened was that the GoogleUtilies Framework was added twice to the Pods project
This would have been fine prior to Xcode 10 but Xcode 10 will complain if a file has two actions against it (in this case a copy action).
It's safe to remove the second framework.
there are some reasons that cause this error to be shown.
1- the project name is the same as a dependency that is used on the project
this error may happen when you choose a name for your project that is the same as one of the dependencies that you use on the project for example you cannot choose FirebaseAuth or GoogleSignIn as the project's name if you use them via pod or SPM.
to solve this problem you should change the project name with the following way:
choose the project from project navigator on the left sidebar, change the project name from the file inspector -> Identity and Type -> name from the right sidebar.
after you change it, XCode asks you to change all relative targets and just press rename.
2 - duplicated info.plist on the Copy Bundle resources portion
you may face this error when info.plist is added to Copy Bundle resources unwanted, choose project form project navigator -> choose target -> goto Build Phases tab -> Copy Bundle Resources and if you see info.plist there, remove it by choose info.plist like the following image
3 - pod files do not work well
sometimes you got this error because the dependencies that you use break for unexpected reasons.
1 - Delete Podfile.lock
2 - Delete Pods directory
3 - Delete Derived Data & Clean (you can find this directory from XCode menu -> Preferences... -> Locations -> Derived Data and go to the directory by clicking the arrow icon at the right of the address)
4 - Exit Xcode
5 - Update CocoaPods with [sudo] gem install cocoapods on mac terminal
6 - goto the project directory on the terminal and run pod install
7 - Open workspace and build
5- duplicated Core data
you may face this problem when you use Core data on the project
first I explain coreData codegen types:
**Class Definition: ** Choose Class Definition when you don’t need to edit the properties or functionality of the managed object subclass and properties files that Core Data generates for you.
Category/Extension: Choose Category/Extension to add additional convenience methods or business logic inside your managed object subclass.
Manual/None: Choose Manual/None to edit the properties in your managed object subclass, for example, to alter access modifiers, and to add additional convenience methods or business logic.
Choose the Manual/None and check if a copy of xcmodeldata is exist on CopyBundleRecources, remove it.
Well, in my case:
If you create two file with same name, will trigger this error.
Remove the one you recently added, will solve this problem.
Hope this helps.
I had this problem when I had a file with the same name in two different targets. For some reason one of those files I had part of both targets. So basically I had two files. And both of those files belonged to one target.
It makes sense that a target can only have one file name per target, so just unchecking the target member box for the file that wasn't related to the main target fixed the issue.
So the problem I was having is that I had accidentally included the Info.plist in the project settings -> Build Phases -> Copy Bundle Resources for my target.
Steps:
Go to Xcode File
Click to WorkSpace Settings
Build System Select as Legacy Build System
Here is another working solution : (If you are using custom Pods)
Select "Pods" from sidebar as highlights in screenshot.
Click on Build Phase. Expand "Headers" section. There are 3 options Public, Private, Project
Expand Public and check there are duplicate files. Remove it. DONE!!
Unfortunately none of these answers worked for me... here was the error I was seeing:
"Multiple commands produce '/Users/.../.../.../Frameworks/abcdef.framework"
That command depends on command ...: script phase ""
That command depends on command ...: script phase ""
Adding this line to the Podfile and doing a " Pod Install " was the ONLY thing that worked.
install! 'cocoapods', :disable_input_output_paths => true
I really hope this helps someone. I spent hours trying to fix this and finally got it.
Sometimes I just wish Xcode was as efficient as IntelliJ / Android Studio :(
Goodluck!
My error was:
duplicate output file
'/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Products/Debug-iphoneos/myAppName.app/GoogleMaps.bundle'
on task: PhaseScriptExecution [CP] Copy Pods Resources
/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Intermediates.noindex/myAppName.build/Debug-iphoneos/myAppName.build/Script-32CCC25BF727B592A1784900.sh
I focused on the problem file being GoogleMaps.bundle and the location of that file being in [CP] Copy Pods Resources, and the fact that it specified it’s a duplicate output file (I highlighted them in black above), it's the 4th step below
First create a copy of your project and make sure you first do the following steps on that copy
1- In the project navigator I went to the blue project icon
2- I choose Build phases
3- Under Build Phases I choose [CP] Copy Pods Resources
4- Under [CP] Copy Pods Resources I went to Output Files and underneath there I found the file that ended with GoogleMaps.bundle. I selected it and pressed the minus sign to delete it. Make sure you go to Output Files and NOT Input Files
5- I did a clean shift+cmmd+k and afterwards when I built the project the error was gone
The odd thing was even though the red error went away the yellow warning was still there but it worked :)
I had bunch of Multiple commands produce warnings - not limited to info.plist duplication in one target. Including localized resources and string files, headers etc.
Solution: remove all duplications in target membership.
Try all this option anyone of this 3 option will work for you, for sure
Option 1: Remove all files from
Target >> Build Phases >> Compile Sources
Target >> Build Phases >> Copy Bundle Resources
Option 2: Change the build system
Xcode->File->Project Settings-> Build System -> Legacy Build System
Option 3: remove and update existing pod
pod cache clean PromisesObjC
pod cache clean PromisesSwift
cd [your_project_dir]
rm -rf Pods/
rm Podfile.lock
pod update
I hope this will help you, Happy coding :-)
Go in Project Build Phase and Remove info.plist from the Compile Sources. It will remove that issue and project will be active again.
It's worth noting that this error can be produced after auto generation of CoreData models where the Codegen is not set to Manual/None.
To correct this in Xcode 10 double click on your xcdatamodeId file and select each of your entities and set Codegen to Manual/None under Class in your Data Model Inspector.

Playground Import: No Such Module 'Foo'

I've diligently followed the Apple instructions to import a custom module into a playground, including the instructions here. And yet I get:
Playground execution failed: /var/folders/z3/kd0nj4ln1rgcpm8bdz7067wh0000gs/T/./lldb/1874/playground1.swift:7:8: error: no such module 'Foo'
import Foo
How can I recover to a working Playground import? [Edit: Note, two answers have produced detailed instructions to associate a playground with a framework; I have followed those instructions but no luck. The solution will need to involve reconfiguring something in Xcode; my installation is apparently broken]
Detailed images of the error and attempts:
Here is another attempt, based on the answer of #EricD, showing the directory structure, no dice.
For some of those that none of the above solutions work (and that Xcode build path setting was already set to Unique), I've found a solution.
The framework must be built with a scheme for an iOS simulator device (any in the list) and NOT a Generic iOS Device, as Playgrounds do not support it. This one worked for me :
Here's how I proceed for OS X with Xcode 7.1:
Create new project: OS X Cocoa Framework, Swift. For this example I named it "TestPlaygroundFMK".
Create a new Swift file.
Add a class to the file. The code has to be public. I made this for our example:
import Foundation
public class Talk {
public class func sayHello() {
print("Hello from framework!")
}
}
Build the project now.
In the menu bar, click on File > Save As Workspace.
Create a new Playground and save it inside the project folder next to the Swift files.
The Playground must not have the same name as the project.
Build the project again.
Import your framework in the Playground and use it:
import TestPlaygroundFMK
Talk.sayHello()
I had my playground working fine but found that when I quit Xcode and re-opened it, I would get an error like this:
error:
/var/folders/ft/bmk8wh6s5ms4my2pxhn3qbp40000gn/T/playground1-9216e0..swift:3:8:
error: no such module 'Playground_Sources' import Playground_Sources
... where "Playground" is the name of my playground file.
The solution to this (in Xcode 9.0) is to:
click any playground file in your workspace
show the Utilities panel (opt-cmd-0)
under "Playground Settings" change the "Platform" to anything else then set it back.
In my case, it's set to macOS. I changed it to iOS then back to macOS (no recompilation necessary) and it started to work fine... that is until I close Xcode and open it again.
This is the only solution I found to work with macOS playgrounds. This bug still exists in Xcode 9.3.
I'm not sure i had the exact problem as the original question - but given the mix and age of solutions and the lack of this one that DID work for me, i thought I'd share.
In Xcode 11+ (tested this on 12.2), i'd often have Playgrounds fail to run givn the "No Such Module" error when it included a framework that is a part of the workspace.
The solution for me was in the "File Inspector" for the Playground, and the "Build Active Scheme" option:
This ensures the project was being built appropriately for the target, and now my annoying compile issues are gone!
Create a workspace as below:
Choose File > New > Workspace
Enter the workspace name, and specify its location in your file system
Click Save
Now, Create a Cocoa framework with swift file which have your class
Choose File > New > Project
Select Cocoa framework > Next
Enter Product Name and Language > Next
Before clicking create, in 'Add to:' and 'Group' list choose 'Your workspace name' as shown
Framework is added to your workspace
Create swift file in your framework
In Xcode right click on the folder where you want to add swift file and select new file...
Select swift > Next > Name your file > Create
Select your framework in Xcode -> Build your framework
Create playground -> Playground should also be part of your workspace, if not drag it to your workspace, it'll be added automatically.
Right click in Xcode's files section > New file... > Playground
import
Call your method
Note: If you just wanted to add classes instead of framework to your playground check the link How to import my own class into an Xcode 7 playground?
Solution that worked for me:
Setup your workspace and project/framework.
Delete derived data (How to remove derived data?)
DO NOT BUILD YOUR PROJECT YET
Create playground file with different name then your project/target/framework name under folder with either Swift files or where .xcodeproj is located (does not matter which one you chose)
Build your project under required platform (if playground is for macOS, then build project with macOS target, etc.)
When build finishes try adding some code to your playground and run it.
P.S. you might need to restart Xcode before 6th step.
The solution, from Apple Support, was to adjust my Xcode Preferences. On Locations :: Advanced my configuration was 'Legacy'. By changing to 'Unique', and undoing any paths I'd attempted to insert, Playgrounds can now import frameworks.
I don't think it's a stretch to say that Xcode is somewhat of a blackbox. I make no claim that this will work for anyone else, but for me, after having the same issue after creating a new playground and a new framework target, and all the other proposed solutions, what finally worked was deleting the workspace file and (in my case) regenerating it with cocoapods.
I have no idea why this worked.
Build the framework with release ,this worked for me. (Xcode 10.1, swift 4.2)
Insert a var at the first line and re run
var str = ""

Problems adding Projects to Workspace in Xcode 4

I have a couple of projects that I had started under Xcode 3.2.x some time ago. I switched to Xcode 4 a few days ago and want to make use of the Workspace feature as both projects. Basically, my plan is to extract some common features out of the two projects and make them a common library that both projects depend on. However, before I even get to the tricky bit of dependencies I get stuck just adding my two projects to the workspace.
I tried creating a new workspace and selecting "Adding files to " from the context menu; I then select the .xcodeproj file from my first project and it appears in the left-hand side tree browser in my workspace. However, it's just the file, not the project that I get. That is, rather than getting a two-line entry in the tree browser where the first line states the project name and the second line says something like "1 target, iOS SDK 4.3" like in the Apple documentation, I get a single line simply stating the name of the .xcodeproj file including the extension. There is also no triangle on the left to expand the node. It's like I just dragged some file in the workspace, not a project. The same goes for the second project.
I have also created a new Project "Foo" from scratch in Xcode 4 and added it to my workspace, with the same result. I looked at Apple documentation and watched the 16 second video about a dozen times now, but cannot work out what I am doing wrong (if the problem is indeed in the chair and not in the computer).
I had this exact same problem. I think it stems from having another workspace already open referencing the project you want to add. I got it working by:
shutdown xcode completely
double-click the workspace to launch Xcode and open just that workspace
drag and drop the project file from the Finder
Worked fine. I have many workspaces all referencing an openssl project, and it seems to work OK when you only have one workspace open at a time in Xcode.
Actually, I made it work without exiting Xcode.
All you have to do is make sure the projects you want to add are closed, since Xcode is having trouble adding open projects to a workspace.
So:
Close the projects you want to add
In the Workspace window, choose "Add Files to MyWorkspace"
Add the .xcodeproj file of the project you want to add
I had the same problem. SO I just exit xcode, restart it. Then I can see the files under the project.
Exiting Xcode completely and then double-clicking the .xcodeproj file to open the project.
It works but when you add an activity to the project than r.java file is automatically removed and errors are coming.

Why is there no Project Item when Deploying VSIX?

We have a VS2010 Beta 2 DSL Project , We can build, deploy and test on our Development machines and all is well i.e When we go to 'Add New Item' we can select our DSL
When it comes to giving the VSIX to someone else to try the ONLY way that they can see the associated Project Item is if they build the DSL Project on their machine, they do not need to F5, it is just a simple Build Solution and then voila they can see it.
Is this a bug or user error?
You might want to update your bits to the RC version, which are now shipping in the VS Visualization & Modeling SDK at http://www.microsoft.com/downloads/details.aspx?FamilyID=cd443b01-d657-4f8b-b5b8-29f1e3e2c424&displaylang=en
This is apparently a known bug
I have found a workaround by adding some guids
{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
into the csproj and manually editing the vsixmanifest to add
ItemTemplates
I created a folder called ItemTemplates and then added the generated project item Zip into the folder , I then set the Zip as Content and changed the IncludeInVSIX property to 'True'
Not pretty but it works

Resources