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

Notification

Icon
Error

NCrunch cannot build my tests project, since it relies on the models project to generate a stub.
otac0n
#1 Posted : Monday, May 23, 2011 1:01:48 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
I am using the Visualization and Modeling SDK to automatically regenerate my T4 templates on build. The T4 template I have reads my EDMX file and automatically generates an In-memory Stub version of my database.

It appears that NCrunch has an issue with that, reporting build failure.

It doesn't appear to be an issue with loading the custom build target, itself. Rather, it appears only when I turn on <TransformOnBuild>true</TransformOnBuild>, and it reports that it cannot find my EDMX file.

Should I somehow re-structure this? Or would it be feasible for NCrunch to do its builds with all files in the same layout as the original solution?
Remco
#2 Posted : Monday, May 23, 2011 5:20:49 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
It's quite possible that in using this SDK you've come across an MSBuild item type that NCrunch doesn't know about.

Can you try adding the missing file using AdditionalFilesToInclude setting in the project's configuration? This is a simple workaround that would help NCrunch to find it.

If you can open up the .proj file containing the file, would you be able to send through to me the MSBuild scripting that describes the file being included? For example:

<ItemGroup>
<ClInclude Include="ClrCpp.h" /> <-------- this line
</ItemGroup>

.. In this way I should be able to fix the issue properly in a future release.


If this doesn't do the trick, please punch through a bug report and I'll take a look at the build log.
otac0n
#3 Posted : Thursday, May 26, 2011 1:35:07 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
Well, NCrunch seems to be handling the MSBuild stuff just fine.

The issue is that NCrunch isn't keeping the whole solution structure consistent, just the individual projects. I'm sure there is a reason it is done that way, but my particular template relies on cross-compiling, basically.

I have already pushed a bug report, so that you have the build log.

However, for a simplified example, imagine this:

2 projects, ProjectA and ProjectB.
The solution has this structure:
Code:
Solution.sln

ProjectA\ProjectA.csproj
ProjectA\File1.txt

ProjectB\ProjectB.csproj
ProjectB\File2.cs


ProjectB has the following post build step (overwriting its File2 with ProjectA's File1):
Code:
copy ..\ProjectA\File1.txt File2.cs


The post build step would fail (under NCrunch) because there is no "ProjectA" directory from which to pull.
Remco
#4 Posted : Thursday, May 26, 2011 5:45:19 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Yes, that is correct.

NCrunch will pull projects out of the solution and build/test them independently from each other. This means that for the system to work correctly, it needs to be possible for your projects to work in isolation.

There are tricks that you can use, such as the AdditionalFilesToInclude setting that allow you to import files from other projects, by claiming that they are part of the project being built. In your case, I think this could work for you in the example you've shown above. When building ProjectB, you could specify "..\ProjectA\File1.txt" as an additional file to include, then turn on the post build event for that project.

I haven't yet come across a project/solution arrangement where it was impossible to make it work like this. I would say though that the amount of effort involved will depend upon how modular your system is and how heavily you have customised the build process.
otac0n
#5 Posted : Thursday, May 26, 2011 11:29:09 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
Is AdditionalFilesToInclude an NCrunch thing or are you re-using an existing mechanism?
Remco
#6 Posted : Thursday, May 26, 2011 10:15:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
It's an NCrunch thing. Because NCrunch needs to pull the entire project out of your working solution and into a workspace, it needs to know which files are required for the project to build/run.

The primary way it handles this is by pulling file references from the .proj file. For everything else you need in the NCrunch workspace, there's AdditionalFilesToInclude :)
Users browsing this topic
Guest
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.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download