[MonoDevelop] iPhone/Android app - how to add a project reference to a library (incompatible target framework)

Miljenko Cvjetko mcvjetko at holisticware.net
Wed Nov 16 02:07:41 EST 2011


Hi Rob

Inline:

On 2011.11.15 17:32, Rob Wilson wrote:
> Hi Mel,
>
> Thanks for the idea, however to use visual studio to paste links in to 
> the target project will not work, because visual studio will not open 
> the iPhone project (although it will open all of the others), since I 
> need to link files into the iPhone project this does not help me in 
> this case.
The reason is simply ProjectType - VS does not understand MonoTouch 
Project type actually it's GUID
see: Using a monotouch project in Visual Studio 2008/2010
at: 
http://www.shrinkrays.net/code-snippets/csharp/monotouch-tips-and-snippets.aspx
and:
http://escoz.com/developing-with-monotouch-on-windows-and-visual-studio/
(This is what our guys have implemented with batch script and we are 
currently in the early
test phase....)

There are few comments about this post:
"7zip does not extract files deeper than 
“…\monotouch-eval-3.1.1\monotouch.pkg”."
The fact is that unzipping must be done twice in order to get what You need!
Remember with all this modern stuff (xap, apk, pkg) if You're stuck try 
renaming it
to zip and unzipping it - it may be hidden/renamed zip archive. It 
usually works for us.
---------------------------------------------------------snip 
---------------------------------------------------------
::echo off

set MONOTOUCH_PKG=monotouch-eval-4.2.2.pkg
set MONOTOUCH_UNPACKED=%MONOTOUCH_PKG:.pkg=%
set PATH_DESTINATION=C:\bin\iOS\MonoTouch\

set PACKER_7ZIP="%ProgramFiles%\7-zip\7z.exe"
::set PACKER_7ZIP=c\bin\7za.exe"
::set PACKER_7ZIP=c:\bin\bzip2-105-x86-win32.exe
:: c:\bin\bzip2-105-x86-win32.exe --decompress %MONOTOUCH_PKG%.zip

echo unpacking %MONOTOUCH_PKG%
echo        to %MONOTOUCH_UNPACKED%

%PACKER_7ZIP%


echo f | xcopy /q /y /i %MONOTOUCH_PKG% %MONOTOUCH_PKG%.zip
%PACKER_7ZIP% x %MONOTOUCH_PKG%.zip -o%MONOTOUCH_UNPACKED%


cd %MONOTOUCH_UNPACKED%\monotouch.pkg
dir Payload
echo f | xcopy /q /y /i Payload Payload.zip
%PACKER_7ZIP% x Payload.zip -oPayload.unpacked

cd Payload.unpacked
move Payload Payload.zip
%PACKER_7ZIP% x Payload.zip -oPayload.unpacked


pause
---------------------------------------------------------snip 
---------------------------------------------------------

If You want I can ask our mac freak how far is he with this stuff!

We have managed to create Visual Studio Solution multi-Project template 
that creates
WP, M4A, SL, WPF, WF and asp.net solution with one duobule-click in VS. 
Right now
we are on the mac side trying to add MonoTouch in the template.
But for that we'll need small batch script with moving files (project 
files for MT) and
a bit of playing with sed (yes we have it on windows.... 8-P.

The script will be used for converting MT files to VS actually 
commenting it out when
comming from Mac world to Windoze and uncommenting project type in 
csproj file:
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Doing it reverse when pushing back to mac...

There are 2 or 3 apps that do that, but we are aiming for batch cos we 
are lazy! Clicking in UI
everytime



>
> I could manually link files, but I just hate the idea of manually 
> doing it, if there's a better way.
You do not have to.... I hate it too....
>
> Thanks again!
Ur welcome

regards

mel
>
> Rob
>
> Sent from my iPhone
>
> On 15 Nov 2011, at 12:52, Miljenko Cvjetko <mcvjetko at holisticware.net 
> <mailto:mcvjetko at holisticware.net>> wrote:
>
>> Hi
>>
>> On 2011.11.15 13:34, Rob Wilson wrote:
>>> Hi all,
>>>
>>> I am attempting to write my first iPhone application and plan to 
>>> ensure that the core code is reusable between the iPhone and Android 
>>> projects.
>>>
>>> I've created a 'Domain' library project, additionally a 'Core' 
>>> library project, both have the 'Target framework' set to 'Mono / 
>>> .NET 4.0' with a compile target set to 'Library'.
>>>
>>> I then created the iPhone / iPad project and tried to link the 
>>> projects together (from within the iPhone project, right-click on 
>>> 'references' then click on the 'edit references' menu option), but 
>>> within the Projects tab  both of my library projects say 
>>> 'Incompatible target framework: v.NETframework, Version=v4.0).
>>>
>>> I am using MonoDevelop version 2.8.2.
>>>
>>> Google searches tend to indicate that I may need to manually link 
>>> each file?! If that's the case fine, but that does seem very 
>>> primitive considering that this is surely a common aim?  Am I 
>>> missing something obvious, or is this how it has to be done?
>> I do not know if MonoDevelop has (yet) such feature: "batch linking", 
>> but push it to shared folder
>> or svn and pull it out on Windows site into Visual Studio.
>> Visual Studio has bunch of extensions on gallery (productivity tools 
>> that enable right click copy and
>> paste as link...
>>
>> or edit project file:
>> link snippet
>> <Compile 
>> Include="..\Core.DLL_022_BL_mClnt_WP7_SL4_netfx4\Collections\Generic\Dictionary.cs">
>> <Link>Collections\Generic\Dictionary.cs</Link>
>> </Compile>
>>
>> VS has great tool - project linker that does that but on project 
>> level as You add files to source (base
>> project with smallest subset of features) they are automagically 
>> linked to (source)-'linked' projects.
>> Unless You do some tweaking to exclude linking....
>>
>> regards
>>
>> mel
>>>
>>> Regards,
>>> Rob.
>>>
>>>
>>>
>>> _______________________________________________
>>> Monodevelop-list mailing list
>>> Monodevelop-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>>
>>
>> -- 
>> Miljenko Cvjetko dipl.ing. ET
>> 	Direktor/CEO
>> 	Projektant rješenja/Solution Architect	
>> 	Razvojni programer/Senior developer
>> 	Voditelj projekta/Project Manager
>>
>> IX južna obala 13
>> Kajzerica Zagreb
>> T: 385 1 7775555
>> M: 385 91 557 447 3
>> F: 385 1 7779556
>> e:mcvjetko at holisticware.net
>> w:http://www.holisticware.net


-- 
Miljenko Cvjetko dipl.ing. ET
	Direktor/CEO
	Projektant rješenja/Solution Architect	
	Razvojni programer/Senior developer
	Voditelj projekta/Project Manager

IX južna obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: mcvjetko at holisticware.net
w: http://www.holisticware.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20111116/d096154e/attachment-0001.html 


More information about the Monodevelop-list mailing list