I have a collection of csproj files that all belong to the same set of source files but have slightly different target data, so I need to save the project files separately. For example. There are options for WinPhone, XBox, Desktop, MonoTouch of the same project.
For things that are really duplicated, such as a list of .cs files to compile, I would like to combine the list into a single file, so I do not have to constantly ensure that all options are kept in sync. I initially tried to do this by deleting the source files from .csprojs and putting them in the .targets file that was imported by all csprojs, but this made the source files disappear from VS and MonoDevelop.
My second attempt was to make the main csproj Desktop file the main one and allow all changes to import this csproj with some conditional logic. This saves the source files editable from the main csproj, and they are built in to all tastes. Visual Studio now understands what I'm trying to do, but MonoDevelop cannot create it. In the MonoDevelop solution, the iOS version of the core DLL is grayed out and says: "(not built into the active configuration)"
I also tried xbuilding csproj and a solution that seems to overcome the problems that MonoDevelop has, but hiccups on other issues related to resolving monotouch builds. I thought MonoDevelop used xbuild, but maybe not?
Since this works on Windows msbuild, it seems to be either an error or a feature not supported in Mono. Or maybe there is a better way to handle the whole scenario ... I thought I'd ask here.
For specificity, My Core.iOS.csproj file looks like this:
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0" > <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>10.0.0</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{AE37B15F-F4BE-48DE-9F20-F00A601EC89E}</ProjectGuid> <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <AssemblyName>Core.iOS</AssemblyName> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="monotouch" /> </ItemGroup> <Import Project=".\Core.csproj" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </Project>
And my Core.csproj file looks like this:
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Core</RootNamespace> </PropertyGroup> <PropertyGroup Condition=" '$(AssemblyName)' == '' "> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{FC495BD8-11B1-46B0-A9DE-F245A0CBEE94}</ProjectGuid> <AssemblyName>Core</AssemblyName> <SignManifests>false</SignManifests> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup> <ItemGroup Condition=" '$(Platform)' == 'AnyCPU' "> <Reference Include="System" /> <Reference Include="System.Core" /> </ItemGroup> <Import Condition=" '$(AssemblyName)' == 'Core' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> <Compile Include="[...]" /> <Compile Include="[...]" /> </Project>
And, as I said, a variant of this seems to work correctly when using VS Express for WinPhone and XBox360 projects. Is this something that should work? Is there a better way to do this?
Thanks,
mono msbuild monodevelop xbuild
Joe castro
source share