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

Notification

Icon
Error

Include as link not copied to NCrunch output?
GreenMoose
#1 Posted : Tuesday, February 20, 2018 9:46:08 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
[v3.12.0.15]

I have a nlog config file in directory A, then I include it "as link" in my test project, and set it to be copied to output if newer, resulting in something like below
Quote:

<ItemGroup>
<None Include="..\CommonFiles\nlog.config" Link="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


When I build this with vstudio I see the nlog.config ending up in output directory, but when NCrunch is building it is not placed in the NCrunch workspace directory and the tests fail.

If I include the file "normally" (without as link) it all works well.

Is this behavior by design?
Thanks.
Remco
#2 Posted : Tuesday, February 20, 2018 11:58:04 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for sharing this issue.

I'm personally unfamiliar with this mechanism (link). Historically, MSBuild has had support for specifying a 'link' file using an XML tag, but this is the first time I've seen it done as an attribute. So probably the reason NCrunch doesn't handle it would be because it's an edge case that has seen no testing or support.

How is it that you've come across this structure? Was this done using a tool or project template?
GreenMoose
#3 Posted : Tuesday, February 20, 2018 12:04:12 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
Remco;11817 wrote:
How is it that you've come across this structure? Was this done using a tool or project template?

I usually do like this when sharing same AssemblyInfo.cs files in multiple projects (which I guess works fine since that file is included in compile process), and now I had duplicated config files I wanted to share in the same way

I.e. no tooling or template, Add->existing item-> select "Add as link" instead of "Add"
Add as link
1 user thanked GreenMoose for this useful post.
michaelkroes on 2/21/2018(UTC)
Remco
#4 Posted : Tuesday, February 20, 2018 10:12:05 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
GreenMoose;11818 wrote:

I usually do like this when sharing same AssemblyInfo.cs files in multiple projects (which I guess works fine since that file is included in compile process), and now I had duplicated config files I wanted to share in the same way

I.e. no tooling or template, Add->existing item-> select "Add as link" instead of "Add"
Add as link


Thanks! We'll take a look and see what we can do.
1 user thanked Remco for this useful post.
GreenMoose on 2/21/2018(UTC)
michaelkroes
#5 Posted : Wednesday, February 21, 2018 2:13:58 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Hi, I've had a look at reproducing this issue. I've created a new ClassLibrary and created a Linked item which shows up in the the project file like this:

Code:

<ItemGroup>
<None Include="..\CommonFiles\LinkedTextFile.txt">
<Link>LinkedTextFile.txt</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


This item is below the project level, but inside the solution. I've added a unit test to the assembly.

Code:

public class Fixture
{
[Test]
public void LinkedFileShouldExist()
{
Assert.That(File.Exists(@"LinkedTextFile.txt"));
}
}


This test passes. Also I double checked the NCrunch workspace. The file is also present there.

Would you mind seeing if you create a test project like this that it works for you?
GreenMoose
#6 Posted : Wednesday, February 21, 2018 2:25:41 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
I used a dotnetCore library for the test though which I guess maybe is the culprit of including it as an attribute?
1 user thanked GreenMoose for this useful post.
michaelkroes on 2/21/2018(UTC)
michaelkroes
#7 Posted : Wednesday, February 21, 2018 2:51:02 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Thanks for getting back so quickly!

I've tried adding a dotnet core class library.

Code:

<ItemGroup>
<None Include="..\CommonFiles\LinkedTextFile.txt" Link="LinkedTextFile.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


This indeed adds the link as an attribute. However in my test project the file is also copied to the work space and a similar test case also passes.
GreenMoose
#8 Posted : Thursday, February 22, 2018 7:52:04 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
michaelkroes;11826 wrote:
However in my test project the file is also copied to the work space and a similar test case also passes.

Hrm yeah it works here as well now when I retry the setup. I guess it might have been related to some other NCrunch internal errors I was having (bug reports submitted) related to projects not reloaded properly.

Thanks.
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.052 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download