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

Notification

Icon
Error

Grid Node .Net Framework 4.5.1 and xUnit 2.0.0 Beta
Ravadre
#1 Posted : Monday, April 28, 2014 12:03:48 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/28/2014(UTC)
Posts: 7
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello,

(note: When I wrote this post, I thought the issue was with .Net Framework 4.5.1, but before posting I downgraded xUnit from 2.0 beta to stable (1.9.2) and the problem does not exist, however, rest of the post, as well as quick fix applies still, just bear in mind that it's not about .net, but xUnit and .net 4.5.1).

I encountered an issue with Grid Node and running tests for .Net Framework 4.5.1 (and xUnit 2.0).

When I try to run tests on server, on which I do have .Net Framework 4.5.1 installed (Windows server 2008 R2, 64 bit) project will not build, however, for version 4.5 everything works fine. Furthermore, it does work locally without any problem.

I managed to fix this issue by changing Build process cpu architecture (NCrunch Configuration -> General Settings -> project -> Build process CPU architecture) to x64, instead of default x86. However, this has to be done for every 4.5.1 project, which is a bit cumbersome.

Error that I receive when trying to run tests on Grid Node without changing architecture (removed unnecessary lines):

Quote:

NCrunch: The build results for this project are not consistent across all computers within the grid.

This project was successfully built on computers: (local)
This project failed to build on computers: VM1

Relevant tests will continue to run on computers that are able to build this project successfully. Please ensure all computers within the grid are configured correctly with all required SDKs installed.

****************** BUILD OUTPUT FROM '(local)' ******************


****************** BUILD OUTPUT FROM 'VM1' ******************

Class1.cs (13): The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Class1.cs (12): 'Xunit.FactAttribute' is not an attribute class

NCrunch: The following files are expected but do not seem to exist on the computer responsible for building this project:
[...]
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Microsoft.CSharp.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Core.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Data.DataSetExtensions.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Data.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll
[...]

Please make sure you have all SDKs required to build this project installed on this computer.


What is interesting, is that although I do have 4.5.1 installed, I don't have this directory in program files (I have 4.5 though), on my dev machine this directory exists. I tried reinstalling framework 4.5.1 and rebooting the server, didn't help.

I tested this on almost empty project, without any dependencies (only xUnit, which is downloaded from nuget).
Remco
#2 Posted : Monday, April 28, 2014 12:30:24 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi,

Thanks for sharing this issue.

NCrunch should normally try to build projects on the grid node using the reference libraries that already exist on the node. The warning message you get about the missing files is a 'catch-all' message that NCrunch will kick up when a build fails and there is a file mismatch between the client and the node. In many cases, file mismatches can be quite normal across CLR DLLs and MSBuild reference targets, as the build will simply work out the new paths and use them instead. NCrunch displays this message because it can provide valuable information in situations where required toolsets exist on the client but not the node.

I think it may be worth trying to narrow down this situation to get a very good idea of what is happening. I find it very curious that changing the build process CPU architecture made a difference in the build result. This seems to imply the failure may be related to a build target of some kind.

What sort of result do you get for this project if you copy the solution over to the grid node manually, then execute MSBuild.exe using the command line against the projects that are failing?
Ravadre
#3 Posted : Monday, April 28, 2014 1:02:41 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/28/2014(UTC)
Posts: 7
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

Firstly, to reproduce an error:
1. Create an empty C# dll project, .Net 4.5.1; Any Cpu.
2. Add xUnit 2.0.0 beta
3. Add an empty test (attribute [Fact] on a public method)
4. Make sure that x86 cpu architecture is set (this should be by default - NCrunch Configuration -> General Settings -> project -> Build process CPU architecture)
5. Try to run tests on a Grid Node server, where .net framework 4.5.1 is installed (I tried that on 2 server, on neither I had VS installed - maybe installed VS fixes this problem?)
6. Project should not build on Grid Node

I tried to reproduce this on Windows Server 2008R2 and Windows 8.0, on both it failed.

I currently have only access to my Windows Server machine, so I tried to build almost empty project using msbuild as you asked, curiously, I get a warning about .Net Framework 4.5.1 not installed, which is strange, as I even reinstalled it and rebooted the server.

I can't seem to build the project with xUnit 2.0.0, so it seems that the problem is not with nCrunch.
I also tried to run 4.5.1 console application compiled with xUnit 2.0.0 and it runs on server without an issue.

Building with 1.9.2, build ok:
(- BROKEN LINK -)(- BROKEN LINK -)[/url]

Building with 2.0.0, build failed:
(- BROKEN LINK -)(- BROKEN LINK -)[/url]
Remco
#4 Posted : Monday, April 28, 2014 1:13:02 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Looking through the failed log, I think there is an important clue here:

Project file contains ToolsVersion="12.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0"

From .NET 4.5, Microsoft have been versioning MSBuild alongside Visual Studio. MSBuild with its tools are now shipped with VS rather than the .NET framework, so there's probably a few things missing on the node that would normally be required in order for the build to run.

Xunit v2 differs from Xunit v1 in that it has runtime components targeting v4.5 of the .NET framework. I believe this was done to introduce support for async/await.

I recommend installing the Windows SDK to see if this solves the problem (http://msdn.microsoft.com/en-us/library/windows/desktop/hh852363.aspx). This is probably a quicker/easier option than installing Visual Studio, which seems like overkill.
Ravadre
#5 Posted : Monday, April 28, 2014 2:05:44 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/28/2014(UTC)
Posts: 7
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I think you are right with the MSBuild issue. Installing windows sdk doesn't seem to help unfortunately.
On MSDN I found:

Quote:
MSBuild is now installed as part of Visual Studio rather than as part of the .NET Framework. The current MSBuild version number is 12.0. If you want to install MSBuild separately, download the installation package from MSBuild Download.


However, link given there doesn't work.

So then I tried to copy C:\Program Files (x86)\MSBuild\12.0\Bin from my dev machine to my server, but I can't run msbuild copied like this (it fails because it can't find tpl dataflow, which is funny, as I don't think it's a part of .net framework (at least it wasn't part of 4.5).

So after manually downloading Tpl Dataflow, I receive an error that this msbuild can't recognize tools version 12.0, although this is the same msbuild which I use on my dev machine.

From server:
Quote:
Microsoft (R) Build Engine version 12.0.30324.0
[Microsoft .NET Framework, version 4.0.30319.18408]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 4/28/2014 3:58:27 PM.
C:\Users\mdeptula\Desktop\ClassLibrary1\xunit2.0\ClassLibrary1.sln.metaproj(2,1
0): error MSB4132: The tools version "12.0" is unrecognized. Available tools ve
rsions are "2.0", "3.5", "4.0".


From dev machine:
Quote:

Microsoft (R) Build Engine version 12.0.30324.0
[Microsoft .NET Framework, version 4.0.30319.18449]
Copyright (C) Microsoft Corporation. All rights reserved.


(same msbuild.exe, but different .net framework is loaded, 18408 vs 18449).

I will try to reinstall .net framework on server once more from offline installer and try that again.

If those problems aren't local for me, I think Grid Node might have problems in the future with other 4.5.1 specific libraries, as I think it's common to use Grid Node where you don't want to install Visual Studio.
Ravadre
#6 Posted : Monday, April 28, 2014 3:21:22 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/28/2014(UTC)
Posts: 7
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I made some progress, link you gave me installed Windows 8 sdk, which contains .net framework 4.5 sdk, there's a newer package, 8.1, which contains 4.5.1 sdk here: http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx.

After installing it, I still don't have msbuild 12.0 where it should be, but Grid Node is able to build project correctly, however, some warning are printed, which refer to the fact, that msbuild 12 seems to be missing.
What has been installed are dlls in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1 which were missing previously.

Quote:

NCrunch: This project was built on server 'VM1'


WARNING - NCrunch: This project has been built with MSBuild v4.0 because MSBuild v12.0 was not found on this server. Some build tasks may fail when not executed using the correct version of MSBuild.

NCrunch: The following files are expected but do not seem to exist on the computer responsible for building this project:
C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.props
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.CurrentVersion.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NETFramework.props
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NetFramework.CurrentVersion.props
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\CodeAnalysis\Microsoft.CodeAnalysis.targets
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NETFramework.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NetFramework.CurrentVersion.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.WinFX.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Data.Entity.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Xaml.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.WorkflowBuildExtensions.targets
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TeamTest\Microsoft.TeamTest.targets
C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.ImportAfter.Targets
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets
C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Microsoft.VisualStudio.Silverlight.SDKTools.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.ServiceModel.targets

Please make sure you have all SDKs required to build this project installed on this computer.

Remco
#7 Posted : Monday, April 28, 2014 11:29:28 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Great to hear that this did the trick. I'm sorry about linking to the older version.

Don't worry about the missing targets files. These are targets files that are being loaded by the MSBuild process on your client machine, but they don't exist on the grid node. As the project builds correctly, the targets clearly aren't needed. As much of the internals of MSBuild are not visible to NCrunch, it isn't able to identify whether a missing target is truly the cause of a build error, so it just reports the information and lets you make up your own mind. I may revise the text on this warning so it seems more like a warning and less like an error.
Ravadre
#8 Posted : Tuesday, April 29, 2014 7:55:42 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/28/2014(UTC)
Posts: 7
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thank you for help.

You definitely pointed me in the right direction.

I also checked if this would resolve the issue on Windows 8.0 machine and it did.
1 user thanked Ravadre for this useful post.
Remco on 4/29/2014(UTC)
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.076 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download