Welcome Guest! To enable all features please Login or Register.



Use in solution with VC++ project
#1 Posted : Tuesday, February 7, 2012 5:24:40 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2012(UTC)
Posts: 1
Location: London


My solution contains one VC++ project that builds a DLL which is used by my test assembly. This unmanaged DLL is required to run the tests (basically, my .NET assembly will be testing against the unmanaged version).

Now when I configure NCrunch in my solution it will try to build the VC++ project and, as far as I can see, will try to load the unmanaged DLL as if it were managed, giving me an error:


NCrunch: If you are experiencing problems in getting this project to build, have a look at https://www.ncrunch.net/...ng_project-build-issues
(0): System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem)
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at nCrunch.Reflection.Cecil.CustomCecilAssemblyResolver.LoadAssembly(String compiledAssemblyFilePath, IDictionary`2 documentFilePathMap)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly..ctor(String builtAssemblyFilePath, IList`1 adjustedAssemblyReferences, IDictionary`2 codeFilePathsByWorkspaceFilePath, Boolean instrumentForPerformanceMeasurement)
at nCrunch.Compiler.RemoteBuildRunner.#=qG3xdYhfR9FrLKjSk7_DjKTEHGSCh98p3RXMZRew3v94=(ComponentBuildParameters #=qdxVPMjovJt8faoeOknNjoA==, String #=q_Vd_hVdT8ec$sXMmcu$iiwI6vfq43uyiWq3iGXbN3Tk=, BuildOutput #=qCE28jExqmIRdWsuiBUzoIQ==, String #=qDISW8vYeJKSpzLfOxACHpG_LUfk0kp_p0n_fP40Rmg0=)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)

Is there any way to workaround this?


#2 Posted : Tuesday, February 7, 2012 8:37:30 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,118

Thanks: 794 times
Was thanked: 1044 time(s) in 994 post(s)
Hi Pedro,

At the moment NCrunch doesn't support C++ projects. The best workaround I can offer would be to avoid creating project references to C++ projects inside your solution - use assembly references instead. Using the IDE, delete all references from other projects in your solution to your C++ project, then replace them with references to the compiled C++ assembly on disk. If you adjust your NCrunch project configuration to enable the 'Ignore this component completely' on the C++ project, NCrunch should be able to build and run tests over your solution while ignoring the C++ project.

This suggestion is theoretical since without your solution I have no way to be sure whether it would work, but my expectation is that NCrunch won't trigger for any changes you make to your C++ project until you manually rebuild it.

I'm keen to hear if this gets you working.


Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.034 seconds.