Class libraries for MonoTouch projects, getting "not built using the active configuration", how to fix it?

I am trying to create a set of class libraries for sharing code between the applications that we are going to make.

However, I cannot create the projects correctly, and I do not see what I am doing wrong.

Let me go through the steps that I use to reproduce this, maybe someone can see what I'm doing wrong:

  • In a new instance of MonoDevelop, I go to File-> New Solution
  • I select the MonoTouch library project template and give it the appropriate name
  • Then I add a new application project to the solution (to simulate the use of the library in the application) of the type "Application for iPhone Single View"
  • I am making an application project a startup project
  • I am adding a link to the library project in the application project
  • Then i create

This works, and if I select the menu item Run-> Debug, I will see how the application opens in the simulator.

Suppose I want to test it on an iPhone now, so I visit the drop-down list on the toolbar, select the target "Debug | iPhone" and immediately select the class library project with:

(not built into the active configuration)

If I right-clicked the solution, check the configuration mappings; when you select something related to the simulator or iPhone, the class library will completely disappear from the view and cannot select for assembly.

There are also 6 elements in the drop-down list of build goals: Debug, Release, Debug / release for iPhone and Debug / release for simulator. Apparently, only debugging and release, which are neither for the iPhone nor for the simulator, end up creating a class library.

What am I doing wrong here?

In another project, where I didn’t have the luxury of being able to look around the solution, I ended up creating an empty, universal project, is this the “right” way to mitigate this?

+7
source share
1 answer

Interestingly, this does not happen if you add the Lib project after the application project.

I created a Lib project, as you described, then added a one-time iPhone app, and then added another Lib (Lib2). Then I compared the text in .sln and found that the 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 at the top of the file. For example, my view looks (scrolls to the end):

 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib", "Lib.csproj", "{A9A8640A-C650-46AB-A21C-DF3B5D22BAA3}" 

Then I reopened the solution, and now Lib is available in the Debug|iPhone and Debug|iPhoneSimulator .


As a side note, although Lib was not built in Debug|iPhone or Debug|iPhoneSimulator , the binary from Debug was compatible. I could create and run the application just fine.

+2
source

All Articles