I am trying to build up a set of class libraries to share code between applications that we're going to make.
However, I am unable to create the projects correctly and I can't see what I'm doing wrong.
Let me go through the steps I use to reproduce this, maybe someone here can see what I'm doing wrong:
This works, and if I pick the Run->Debug menu item, I can see the application opening up in the simulator.
Let's assume I want to test it on the iPhone now, so I visit the dropdown in the toolbar, pick "Debug|iPhone" build target, and immediately the class library project is grayed out with:
(not built in active configuration)
If I right-click the solution, check the Configuration mappings, when picking anything related to the simulator or the iPhone, the class library disappears from view altogether and is unable to select for build.
The build target dropdown also has 6 items now, Debug, Release, Debug/release for iPhone and Debug/release for the simulator. Apparently only the Debug and Release that is not for either iPhone or the simulator ends up building the class library.
What am I doing wrong here?
In a different project where I did not have the luxury of being able to look around for a solution, I ended up creating an empty universal project, is that the "correct" way to mitigate this?
Interestingly, this doesn't happen if you add the Lib project after the App project.
I created the Lib project as you described, then added a Single-View iPhone App, then added another Lib (Lib2). I then compared the text in the .sln and found that Lib was missing the following lines (compared to Lib2):
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Debug|iPhone.Build.0 = Debug|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Release|iPhone.ActiveCfg = Release|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Release|iPhone.Build.0 = Release|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
Use your own GUID instead of mine. The GUID will be near the top of the file. For example, mine looks like (scroll to the end):
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib", "Lib.csproj", "{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}"
I then re-opened the solution and Lib is now available in both the Debug|iPhone
and Debug|iPhoneSimulator
configurations.
As a side note, even though the Lib wouldn't build in Debug|iPhone
or Debug|iPhoneSimulator
, the binary from Debug
was compatible. I could build and run the App just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With