referencing mixed platform 3rd party assembly in custom task creation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

referencing mixed platform 3rd party assembly in custom task creation

Munawar Rashid

I'm trying to create some a custom task to interact with our VisualSVN repo using SharpSVN api. I added a reference to the dll. I have one csproj file which all my individual task class files are bound to. It compiles fine, but with following warning.

There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SharpSvn", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.  

Then when I run the task, it is failing with following message

System.IO.FileNotFoundException: Could not load file or assembly 'SharpSvn, Version=1.7002.1998.12257, Culture=neutral, PublicKeyToken=d729672594885a28' or one of its dependencies. The system cannot find the file specified.
File name: 'SharpSvn, Version=1.7002.1998.12257, Culture=neutral, PublicKeyToken=d729672594885a28'
   at XXX.Build.NAnt.CustomTasks.getSVNRevisionListTask.ExecuteTask()
   at NAnt.Core.Task.Execute()
   at NAnt.Core.Target.Execute()
   at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
   at NAnt.Core.Project.Execute()
   at NAnt.Core.Project.Run()

Per somebody's suggestion in an online forum, I created a dll config file with the following content.

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>

But the problem persists. I also noted that nant.exe.config also has this entry, but without the useLegacyV2RuntimeActivationPolicy setting.

The SharpSVN dll should target win32/x86 platform. Although, I'm trying out the custom task in a widows server 2008 r2 server, I couldn't get the reference to x64 version of the dll to work with a console app, I was trying out earlier, leading me to stick with the x86 version.

Has anybody faced similar issue with referencing assemblies for custom task that may not be compiled with anycpu platform setting. Does NAnt have an intrinsic way to deal with this kind of scenario. The fact that the 'startup' entry is there in the config, tells me that some such feature may have been attempted in nant.

Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
NAnt-users mailing list
[hidden email]