Start a new topic

Strange Compiler error using MSBUILD on mac

Platform: AnyCPU

Configuration: Debug

TargetFrameworkVersion: v4.5


Build started 7/29/2015 3:51:55 AM.

__________________________________________________

Project "/volumes/projects/testduo/testduo.web/testduo.web.csproj" (Build target(s)):

 Target PrepareForBuild:

  Configuration: Debug Platform: AnyCPU

 Target AfterResolveReferences:

: error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

  Build FAILED.

  Errors:

  /volumes/projects/testduo/testduo.web/testduo.web.csproj (Build) ->

  /volumes/projects/testduo/packages/DuoCode.1.1.1423.0/build/DuoCode.targets (AfterResolveReferences target) ->

   : error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

    0 Warning(s)

    1 Error(s)

  Time Elapsed 00:00:01.1527390




ANY HELP ON WHAT IS GOING ON IN DUOCODE.Targets

that can explain that...


I think it has a releation to the (4.0 vs 12.0 version of xmuild msbuild engine)


We need some more information.

Is it XBuild run on Mac?

Is it happens on Linux too?

Which version of Mono are you using?

Its using Xbuild 12 API (Microsoft Build Engine Clone API for xbuild):


In my code I MUST HAVE TO DO SOMETHING TO MAKE IT THINK ITS XBUILD...


SOME KINDA OF MSBUILD command to FORCE xbuild mode might work...


Anyways this is the code i use to build projects via code on my mac... NOTE HAS BEEN  WORKING

FOR ANY OTHER PROJECT TYPE FOR YEARS.


Anyways:


/// <summary>
/// MSBuild project using Microsoft Build Engine (Microsoft.Build.Engine)
/// </summary>
public static bool BuildProject(string cs_project, ILogger[] loggers, string tools, string[] targets, NameValueCollection properties, bool validate, string schema)
{
// Setup engine
Engine engine = Engine.GlobalEngine;
if (!String.IsNullOrEmpty(tools)) {
if (engine.Toolsets[tools] == null) {
throw new Exception("Unknown build tools version: " + tools);
}
//engine.DefaultToolsVersion = tools;
}

bool success = false;
try {
// Setup properties
var globalProperties = new BuildPropertyGroup();
if (properties != null && properties.Count > 0) {
if (properties.HasKeys()) {
foreach (string key in properties.AllKeys) {
globalProperties.SetProperty(key, properties[key]);
}
}
}
//engine.GlobalProperties = globalProperties;

// Setup loggers
if (loggers != null && loggers.Length > 0) {
foreach (ILogger logger in loggers) {
engine.RegisterLogger(logger);
}
}

// Setup project
engine.CreateNewProject();
if (validate) {
string binPath = ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version20);
string defaultSchema = Path.Combine(binPath, "Microsoft.Build.xsd");
if (!String.IsNullOrEmpty(schema) && File.Exists(schema)) {
project.SchemaFile = schema;
} else if (File.Exists(defaultSchema)) {
project.SchemaFile = defaultSchema;
}
}

// Build project
success = engine.BuildProjectFile(cs_project, targets, globalProperties, null, BuildSettings.None, tools);
} finally {
try { engine.UnregisterAllLoggers(); } catch { }
}
return success;
}


How are you detecting if xbuild?



The problem seems to be something when calling programmatically using XBuild 12 API....


WHICH IS THE EXACT SAME API calls xbuild is using... i even made a version using the xbuild source code.

maybe it has something to do with being called from a actual native command line as apposed thru the API.


Is there some override(Dcc Args) i can pass to make it think its coming from a command line? 

Here is the verbose error part saying it cant cast DuoCode.Compiler.TaskIncompatibleReferences:


Please a look at, maybe you will have some ideas on how i can get to work:


Building target "AfterResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "ResolveReferences" depends on it.

 Target AfterResolveReferences:

 Task "TaskIncompatibleReferences"

  InvalidCastException, ITask: Microsoft.Build.Framework.ITask, Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Task type: DuoCode.Compiler.TaskIncompatibleReferences, csi, Version=1.1.1423.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

: error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

  Error initializing task TaskIncompatibleReferences: System.InvalidCastException: Cannot cast from source type to destination type.

    at Microsoft.Build.BuildEngine.BuildTask.InitializeTask () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:204 

  Done building target "AfterResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "ResolveReferences" depends on it.

  Done building target "ResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

  OnError for target CoreBuild skipped due to false condition: '$(RunPostBuildEvent)' == 'Always' or '$(RunPostBuildEvent)' == 'OnOutputUpdated'

  Building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Building target "_GetCompileOutputsForClean" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "_RecordCleanFile" depends on it.

  Done building target "_GetCompileOutputsForClean" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "_RecordCleanFile" depends on it.

   Target _RecordCleanFile:

   Task "ReadLinesFromFile"

    Using task ReadLinesFromFile from Microsoft.Build.Tasks.ReadLinesFromFile, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "ReadLinesFromFile"

   Task "FindUnderPath"

    Using task FindUnderPath from Microsoft.Build.Tasks.FindUnderPath, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "FindUnderPath"

   Task "RemoveDuplicates"

    Using task RemoveDuplicates from Microsoft.Build.Tasks.RemoveDuplicates, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "RemoveDuplicates"

   Task "WriteLinesToFile"

    Using task WriteLinesToFile from Microsoft.Build.Tasks.WriteLinesToFile, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "WriteLinesToFile"

   Done building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

  Done building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Done building target "CoreBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

  Done building target "Build" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Target perfomance summary:

       0.208 ms SplitProjectReferencesByExistent 1 calls

       0.749 ms ResolveProjectReferences 1 calls

       1.927 ms _GetCompileOutputsForClean 1 calls

       2.125 ms _AddCorlibReference 1 calls

       3.323 ms GetFrameworkPaths 1 calls

       3.693 ms AssignLinkMetadata 1 calls

       7.516 ms _ValidateEssentialProperties 1 calls

       8.956 ms _RecordCleanFile 1 calls

      19.900 ms PrepareForBuild 1 calls

      32.223 ms AfterResolveReferences 1 calls

      35.667 ms GetReferenceAssemblyPaths 1 calls

      89.721 ms ResolveAssemblyReferences 1 calls

  Tasks perfomance summary:

       1.175 ms GetFrameworkPath 1 calls

       1.383 ms FindUnderPath 1 calls

       1.650 ms RemoveDuplicates 1 calls

       1.806 ms CreateProperty 2 calls

       2.497 ms WriteLinesToFile 1 calls

       2.584 ms ReadLinesFromFile 1 calls

       2.830 ms MakeDir 1 calls

       4.036 ms FindAppConfigFile 1 calls

       6.784 ms CreateItem 2 calls

      11.278 ms Message 1 calls

      15.937 ms GetReferenceAssemblyPaths 1 calls

      17.987 ms TaskIncompatibleReferences 1 calls

      82.061 ms ResolveAssemblyReference 1 calls

  Build FAILED.

  Errors:

  /users/mackey/projects/w1/w1.web/w1.web.csproj (Build) ->

  /users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets (AfterResolveReferences target) ->

   : error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

    0 Warning(s)

    1 Error(s)

  Time Elapsed 00:00:00.3825380


Just in case you need see all the path info


Building: W1.Web (Debug)

AjaxGateway.Net - Web Application Toolkit

Version 1.0.1.1

Building...


Target: Build

Platform: AnyCPU

Configuration: Debug

TargetFrameworkVersion: v4.5

Tester1: Tester value goes here

Tester2: Another values goes here

Loading default tasks for ToolsVersion: 12.0 from /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.tasks


Build started 7/31/2015 11:49:19 AM.

__________________________________________________

Loading default tasks for ToolsVersion: 4.0 from /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/Microsoft.Common.tasks

/users/mackey/projects/w1/w1.web/w1.web.csproj: Importing project /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/Microsoft.CSharp.targets 

/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/Microsoft.CSharp.targets: Importing project /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/Microsoft.Common.targets 

/users/mackey/projects/w1/w1.web/w1.web.csproj: Importing project /users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets 

Project "/users/mackey/projects/w1/w1.web/w1.web.csproj" (Build target(s)):


Initial Properties:

__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0

Ajax-Gateway-Properties = <Ajax-Gateway-Properties Enabled="True" Rebuild="False" Parse="True" DuoCode="True" Tools="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><Properties><GatewayBuildProperty Name="Tester1" Value="Tester value goes here" /><GatewayBuildProperty Name="Tester2" Value="Another values goes here" /></Properties></Ajax-Gateway-Properties>

Apple_PubSub_Socket_Render = /private/tmp/com.apple.launchd.NzeVvz1456/Render

AssemblyName = W1.Web

Configuration = Debug

ConsolePause = false

DebugSymbols = true

DebugType = full

DefineConstants = DEBUG;

DYLD_FALLBACK_LIBRARY_PATH = /Applications/Xamarin Studio.app/Contents/Resources/lib:/Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin:/Library/Frameworks/Mono.framework/Versions/Current/lib:/lib:/usr/lib:/Library/Developer/CommandLineTools/usr/lib:/usr/local/lib

ErrorReport = prompt

GTK2_RC_FILES = /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/gtkrc.mac-yosemite

HOME = /Users/Mackey

LOGNAME = Mackey

MONO_GAC_PREFIX = /Applications/Xamarin Studio.app/Contents/Resources

MONODEVELOP_CONSOLE_LOG_LEVEL = All

MONODEVELOP_DEV_ADDINS = /Users/Mackey/Projects/AjaxGatewayTools/bin/Debug

MSBuildBinPath = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin

MSBuildExtensionsPath = /Library/Frameworks/Mono.framework/External/xbuild

MSBuildExtensionsPath32 = /Library/Frameworks/Mono.framework/External/xbuild

MSBuildExtensionsPath64 = /Library/Frameworks/Mono.framework/External/xbuild

MSBuildFrameworkToolsPath = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5

MSBuildFrameworkToolsPath32 = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5

MSBuildProjectDefaultTargets = Build

MSBuildProjectDirectory = /users/mackey/projects/w1/w1.web

MSBuildProjectExtension = .csproj

MSBuildProjectFile = w1.web.csproj

MSBuildProjectFullPath = /users/mackey/projects/w1/w1.web/w1.web.csproj

MSBuildProjectName = w1.web

MSBuildThisFile = w1.web.csproj

MSBuildThisFileDirectory = /users/mackey/projects/w1/w1.web/

MSBuildThisFileDirectoryNoRoot = users/mackey/projects/w1/w1.web/

MSBuildThisFileExtension = .csproj

MSBuildThisFileFullPath = /users/mackey/projects/w1/w1.web/w1.web.csproj

MSBuildThisFileName = w1.web

MSBuildToolsPath = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin

MSBuildToolsPath32 = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin

MSBuildToolsRoot = /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0

MSBuildToolsVersion = 12.0

Optimize = false

OS = Unix

OutputPath = Scripts

OutputType = Library

PATH = /Applications/Xamarin Studio.app/Contents/Resources:/Applications/Xamarin Studio.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin

PKG_CONFIG_LIBDIR = 

PKG_CONFIG_PATH = /Applications/Xamarin Studio.app/Contents/Resources/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.0.2/share/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/pkgconfig

Platform = AnyCPU

ProjectGuid = {40924D90-3AF1-40E0-A8A1-6D4E03C222B6}

RootNamespace = W1.Web

SHELL = /bin/bash

SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.oQkFBJD3wa/Listeners

TargetFrameworkVersion = v4.5

Tester1 = Tester value goes here

Tester2 = Another values goes here

TMPDIR = /var/folders/jy/8yg97j0s38l6c57sz6fhn36r0000gn/T/

USER = Mackey

WarningLevel = 4

XPC_FLAGS = 0x0

XPC_SERVICE_NAME = com.xamarin.monodevelop.97728


Initial Items:

/users/mackey/projects/w1/w1.web/w1.web.csproj: Importing project /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets from extension path /Library/Frameworks/Mono.framework/External/xbuild

/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets: Importing project /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets 

/users/mackey/projects/w1/w1.web/w1.web.csproj: Importing project /users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets 

Building target "_ValidateEssentialProperties" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

Done building target "_ValidateEssentialProperties" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

Building target "Build" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

Building target "BuildOnlySettings" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

Done building target "BuildOnlySettings" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

Building target "BeforeBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

Done building target "BeforeBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

Building target "CoreBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

Building target "PrepareForBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "AssignLinkMetadata" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "PrepareForBuild" depends on it.

Done building target "AssignLinkMetadata" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "PrepareForBuild" depends on it.

 Target PrepareForBuild:

 Task "Message"

  Using task Message from Microsoft.Build.Tasks.Message, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

  Configuration: Debug Platform: AnyCPU

 Done executing task "Message"

 Task "FindAppConfigFile"

  Using task FindAppConfigFile from Microsoft.Build.Tasks.FindAppConfigFile, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "FindAppConfigFile"

 Task "MakeDir"

  Using task MakeDir from Microsoft.Build.Tasks.MakeDir, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "MakeDir"

 Done building target "PrepareForBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

Done building target "PrepareForBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "GetFrameworkPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

 Target GetFrameworkPaths:

 Task "GetFrameworkPath"

  Using task GetFrameworkPath from Microsoft.Build.Tasks.GetFrameworkPath, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "GetFrameworkPath"

 Task "CreateProperty"

  Using task CreateProperty from Microsoft.Build.Tasks.CreateProperty, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "CreateProperty"

 Done building target "GetFrameworkPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

Done building target "GetFrameworkPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "GetReferenceAssemblyPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

 Target GetReferenceAssemblyPaths:

 Task "CreateProperty"

  Using task CreateProperty from Microsoft.Build.Tasks.CreateProperty, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "CreateProperty"

 Task "GetReferenceAssemblyPaths"

  Using task GetReferenceAssemblyPaths from Microsoft.Build.Tasks.GetReferenceAssemblyPaths, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

  Looking for framework '.NETFramework,Version=v4.5' in root path '/Library/Frameworks/Mono.framework/External/xbuild-frameworks'

  Unable to find framework definition file '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml' for Target Framework Moniker '.NETFramework,Version=v4.5'

  Looking for framework '.NETFramework,Version=v4.5' in root path '/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/../xbuild-frameworks'

  Found framework definition list '/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/../xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml' for framework '.NETFramework,Version=v4.5'

 Done executing task "GetReferenceAssemblyPaths"

 Done building target "GetReferenceAssemblyPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

Done building target "GetReferenceAssemblyPaths" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "PreBuildEvent" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Target PreBuildEvent skipped due to false condition: '$(PreBuildEvent)' != ''

Done building target "PreBuildEvent" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "ResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

Building target "BeforeResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Done building target "BeforeResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Building target "ResolveProjectReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Building target "SplitProjectReferencesByExistent" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveProjectReferences" depends on it.

Building target "AssignProjectConfiguration" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "SplitProjectReferencesByExistent" depends on it.

Target AssignProjectConfiguration skipped due to false condition: '@(ProjectReference)' != ''

Done building target "AssignProjectConfiguration" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "SplitProjectReferencesByExistent" depends on it.

Done building target "SplitProjectReferencesByExistent" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveProjectReferences" depends on it.

Done building target "ResolveProjectReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Building target "ResolveAssemblyReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Building target "_AddCorlibReference" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets"); "ResolveAssemblyReferences" depends on it.

Done building target "_AddCorlibReference" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.CSharp.targets"); "ResolveAssemblyReferences" depends on it.

 Target ResolveAssemblyReferences:

 Task "CreateItem"

  Using task CreateItem from Microsoft.Build.Tasks.CreateItem, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "CreateItem"

 Task "CreateItem"

  Using task CreateItem from Microsoft.Build.Tasks.CreateItem, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

 Done executing task "CreateItem"

 Task "ResolveAssemblyReference"

  Using task ResolveAssemblyReference from Microsoft.Build.Tasks.ResolveAssemblyReference, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

  TargetFrameworkDirectories:

   /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5

   /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/Facades/

  SearchPaths:

   {CandidateAssemblyFiles}

   {HintPathFromItem}

   {TargetFrameworkDirectory}

   {PkgConfig}

   {GAC}

   {RawFileName}

   Scripts/

  Primary Reference mscorlib

   Reference mscorlib resolved to /users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build//../tools/mscorlib.dll. CopyLocal = False

   Reference found at search path {HintPathFromItem}

  For searchpath {CandidateAssemblyFiles}

  Warning: {CandidateAssemblyFiles} not supported currently

  For searchpath {HintPathFromItem}

  Primary Reference AjaxGateway.Duo

   Reference AjaxGateway.Duo resolved to ../packages/AjaxGateway.Duo.1.0.1.44/lib/net45/AjaxGateway.Duo.dll. CopyLocal = True

   Reference found at search path {HintPathFromItem}

  For searchpath {CandidateAssemblyFiles}

  Warning: {CandidateAssemblyFiles} not supported currently

  For searchpath {HintPathFromItem}

  Primary Reference from AssemblyFiles /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/4.5/mscorlib.dll

 Done executing task "ResolveAssemblyReference"

 Done building target "ResolveAssemblyReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

Done building target "ResolveAssemblyReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "ResolveReferences" depends on it.

Building target "AfterResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "ResolveReferences" depends on it.

 Target AfterResolveReferences:

 Task "TaskIncompatibleReferences"

  InvalidCastException, ITask: Microsoft.Build.Framework.ITask, Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Task type: DuoCode.Compiler.TaskIncompatibleReferences, csi, Version=1.1.1423.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

: error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

  Error initializing task TaskIncompatibleReferences: System.InvalidCastException: Cannot cast from source type to destination type.

    at Microsoft.Build.BuildEngine.BuildTask.InitializeTask () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:204 

  Done building target "AfterResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "ResolveReferences" depends on it.

  Done building target "ResolveReferences" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "CoreBuild" depends on it.

  OnError for target CoreBuild skipped due to false condition: '$(RunPostBuildEvent)' == 'Always' or '$(RunPostBuildEvent)' == 'OnOutputUpdated'

  Building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Building target "_GetCompileOutputsForClean" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "_RecordCleanFile" depends on it.

  Done building target "_GetCompileOutputsForClean" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets"); "_RecordCleanFile" depends on it.

   Target _RecordCleanFile:

   Task "ReadLinesFromFile"

    Using task ReadLinesFromFile from Microsoft.Build.Tasks.ReadLinesFromFile, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "ReadLinesFromFile"

   Task "FindUnderPath"

    Using task FindUnderPath from Microsoft.Build.Tasks.FindUnderPath, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "FindUnderPath"

   Task "RemoveDuplicates"

    Using task RemoveDuplicates from Microsoft.Build.Tasks.RemoveDuplicates, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "RemoveDuplicates"

   Task "WriteLinesToFile"

    Using task WriteLinesToFile from Microsoft.Build.Tasks.WriteLinesToFile, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

   Done executing task "WriteLinesToFile"

   Done building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj".

  Done building target "_RecordCleanFile" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Done building target "CoreBuild" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets"); "Build" depends on it.

  Done building target "Build" in project "/users/mackey/projects/w1/w1.web/w1.web.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets").

  Target perfomance summary:

       0.208 ms SplitProjectReferencesByExistent 1 calls

       0.749 ms ResolveProjectReferences 1 calls

       1.927 ms _GetCompileOutputsForClean 1 calls

       2.125 ms _AddCorlibReference 1 calls

       3.323 ms GetFrameworkPaths 1 calls

       3.693 ms AssignLinkMetadata 1 calls

       7.516 ms _ValidateEssentialProperties 1 calls

       8.956 ms _RecordCleanFile 1 calls

      19.900 ms PrepareForBuild 1 calls

      32.223 ms AfterResolveReferences 1 calls

      35.667 ms GetReferenceAssemblyPaths 1 calls

      89.721 ms ResolveAssemblyReferences 1 calls

  Tasks perfomance summary:

       1.175 ms GetFrameworkPath 1 calls

       1.383 ms FindUnderPath 1 calls

       1.650 ms RemoveDuplicates 1 calls

       1.806 ms CreateProperty 2 calls

       2.497 ms WriteLinesToFile 1 calls

       2.584 ms ReadLinesFromFile 1 calls

       2.830 ms MakeDir 1 calls

       4.036 ms FindAppConfigFile 1 calls

       6.784 ms CreateItem 2 calls

      11.278 ms Message 1 calls

      15.937 ms GetReferenceAssemblyPaths 1 calls

      17.987 ms TaskIncompatibleReferences 1 calls

      82.061 ms ResolveAssemblyReference 1 calls

  Build FAILED.

  Errors:

  /users/mackey/projects/w1/w1.web/w1.web.csproj (Build) ->

  /users/mackey/projects/w1/packages/DuoCode.1.1.1423.0/build/DuoCode.targets (AfterResolveReferences target) ->

   : error : Error initializing task TaskIncompatibleReferences: Cannot cast from source type to destination type.

    0 Warning(s)

    1 Error(s)

  Time Elapsed 00:00:00.3825380


---------------------- Done ----------------------


Build successful.


First of all please try to set this (in your project or via your build engine setup):

<DuoCodeRunAsCommandLine>true</DuoCodeRunAsCommandLine>


This is how we detect XBuild inside (taken from DuoCode.targets):

<IsXBuild Condition="'$(MSBuildRuntimeVersion)' == ''">true</IsXBuild> <!-- XBuild/Mono detection -->


Can you explain us, why not to use official xbuild on Mac?, like: mono xbuild your_project.csproj


Hope this helps.


Also try to comment out (in our DuoCode.targets call to TaskIncompatibleReferences task, lines: 83-85) will it help?

I am using the API to build my DUO code projects because i am using them FROM inside the Xamarin Studio IDE.


I have integrated my build server into Xamarin Studo because the default native xbuild DOES NOT work with... Like it does not process errors and warnings. Plus i can easily send global parameters to msbuild engine from IDE.


Right now, i just crammed the original Microsoft Build Engine dll (4.0) into the Xamarin IDE... you are right they are NOT 100% compatible... But the Basic Builde Engine and ConsoleLogger DOES WORK just... So i just built my plugin around those issues using just enough of the API to create the build server.


I will try these suggestions to see if i can get the native XBUILD API to work with full IDE intergration like

i as able to using the original MSBuild Engine.


I am still working a few things in AjaxGateway.Duo Web Application Toolkit. I will then make a few videos showcasing the AjaxGateway (A GWT Like development toolkit for creating COMPLEX AJAX HOST APPLICATIONS... Supporting both native and now thanks to DuoCode... HTML5 clients... All with C#)


The AjaxGateway brings .NET patterns and practices toHTML5 applications.


Uses NATIVE .NET C# implementation (which still gets compiled to javascript) of HTML5 features, like:


1. Inversion Of Control (Ajax.Gateway.Ioc)

2. Event Bus (Ajax.Gateway.Event)

3. Model-View-ViewModel (Ajax.Gateway.Mvvm)

4. Complete String type JQuery Bindings (Ajax.Gateway.Query)

5 Root application manager (System.Root) - Tons of GWT like (RootPanel) and more application functions


and my new HtmlBinder to automatically bind your native C# View Models (based on INotifyPropertyChanged and INotifyCollectionChanged) to your HTML markup... Now you can use your SAME EXACT native business logic, view model and services all ALL your clients


And all integrated into Xamarin Studio (Also works on windows in all version of supported Visual Studio)

Interresting.... DuoCodeRunAsCommandLine like takes car of getting throug all the setup in the DuoCode.targets.


It actually gets to the dcc.exe part.... But fail with exit code 126. Got any clue with that is about, take a look at this output:


/volumes/projects/testduo/testduo.web/testduo.web.csproj (Build) ->

/volumes/projects/testduo/packages/DuoCode.1.1.1423.0/build/DuoCode.targets (CompileDuoCode target) ->

 /volumes/projects/testduo/packages/DuoCode.1.1.1423.0/build/DuoCode.targets: error : Command '"/volumes/projects/testduo/packages/DuoCode.1.1.1423.0/build//../tools/dcc.exe" /nostdlib+ /debug:full /define:DEBUG, /target:Library /warn:4 /out:/Volumes/Projects/TestDuo/TestDuo/Scripts/TestDuo.Web.dll /reference:/volumes/projects/testduo/packages/DuoCode.1.1.1423.0/tools/mscorlib.dll /reference:/Volumes/Projects/TestDuo/packages/AjaxGateway.Duo.1.0.1.48/lib/net45/AjaxGateway.Duo.dll /reference:/volumes/projects/testduo/packages/DuoCode.1.1.1423.0/tools/mscorlib.dll /dccversion:1.1.1423.0 /license:XXXXXXX Properties/AssemblyInfo.cs TestDuo.Web.cs /volumes/projects/TestMe.Lib/GreetingService.cs /volumes/projects/TestMe.Lib/GreetingViewModel.cs /volumes/projects/TestMe.Lib/App.cs' exited with code: 126.


  0 Warning(s)

  1 Error(s)

Please don't publish your private DuoCode license key in public forum. I just deleted it from your last post, to /license:XXXXXXX.


Can you try to "execute" the dcc.exe (mono dcc.exe @response_file.rsp) from your custom build task?

Sorry... was up late... didnt notice i put my license in there... Thanks for catching that :)


... First off. Let me clarify, none of what i am doing is from command line, Either using my own build engine

or the default xbuild system. All thru Xamarin Studio IDE (my plugin pretty much makes development on Mac using Xamarin Studio... ALMOST as easy Visual Studio for windows... Including Project templates with ASP and OWIN based servers supporting SOURCE MAPS from any sub-project location... no need cram everything into one main duocode app and still get EASY source maps for debugging).


Now when it comes to building the project, XBUILD DOES NOT ISSURE ERRORS OR WARNINGS when building duocode projects (dunno why, but it does not work). So if you get and error in a project the ide will still keep building then launch as if nothing was wrong... makes debugging a nightmare. Same thing with any EXTERNAL build system.


So i have to "Intercept" the build process of the ide  (Xamarin Add-In Maker) and build the project myself using the Build Engine API.


If i cram the actual window assemblies (4.0) into Xamarin and ONLY implemebt the basic engine and the consolelogger (i parse errors and warning from each console line output since the window msbuild api does not support build event args).


It works, but kinda cheesy.


Pros:

1... I can pass Global Properties to build process (i have a Xamarin Project GUI panel to manage properties based on project configuration)... including license management


2... I can generate IDE errors and warning for a more natural dev process


Cons:


1... Is not native xbuild so i have to "scrape" output lines instead of using the build engine api events

for errors and warnings


2... I am craming windows msbuild dlls into a mac xamarin studio (works, but limited api support) and lock me into 4.0 Toolset Only



But if i can just simply switch those five msbuild assemblies to the XBUILD 12 api that native to mac and xamarin studio ... ALL WOULD BE GREAT and not have to do do any of this stuff to get native ide support.


Now the native xbuild engine i described above works on ANY and ALL other projects types... prefectly, EXCEPTS duo code projects (i now there is a alot of magic happening in the DuoCode.targets that utimately call dcc.exe, but for some reason dont work from api).


I even took the SAME EXACT source for xbuild itself (really easy...one class called MainClass.. does everything with string[] args)... Ran it inside the a "process" and it fails... But get out of .net and run if from command line (xbuild myproj.csproj or mono xbuild.exe myproj.csproj) works fine.


Its like it knows its running from an actual command line environment... Also..if i just set DuoCodeRunAsCommandLine = true.. it gets Exit code 129 or 126 (one of those)... Really weird.


So anyways, for now i have settled on just using the "Rigged Up" windows dlls and scrape output lines for errors and warnings until i (with your help) can get that native xbuild api to build a duo code project from the xamarin studio ide with full error and warning support :)


Login or Signup to post a comment