Hudson : warning MSB3245: Could not locate the assembly "nunit.framework"

29,176

Solution 1

The issue isn't the nunit-console.exe (or whatever the name).

The issue is that you cannot find nunit.framework.dll...as a reference in your project file (.csproj for C#).

Your unit-test project, you need to open it and find how/where the reference to the nunit.framwork.dll is wired.

Post the .csproj code if that is confusing.

EDIT:

<HintPath>Dll\nunit.framework.dll</HintPath>

The issue is that you need to "download" or copy or svn-export or svn-checkout or nuget-get that file. And place it in the relative directory to your .csproj.

Because you have specified a HintPath, it will NOT find the one in this below directory:

C:\Program Files (x86)\NUnit 2.X.Y\bin\nunit.framework.dll

Basically, the HintPath says "I expect to find this file HERE", and your MSBUILD error says "I did not find it where the HintPath said it would be."

Solution 2

Under which user account does jenkins-slave.exe (or hudson slave) run on your VM node?

Paths to .NET dlls are registered in windows registries (HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation").

By default jenkins runs jenkins-slave service under NT AUTHORITY\SYSTEM account (who probably doesn't have any AssemblyLocations registered on your system).

I filled my user acount login (under which the .csproj builds like a charm) details into jenkins -> nodes -> VM -> config and additionally set that same user account under which Windows runs the "jenkins slave" service (in VM's Windows Services -> jekins slave -> properties -> Log on -> This account: ...)

So it's working without specifying hint path in .csproj, because it is machine specific (my builds are running on multiple machines).

Share:
29,176

Related videos on Youtube

Farah
Author by

Farah

Updated on April 28, 2020

Comments

  • Farah
    Farah about 4 years

    I'm working in a Virtual Machine as a Hudson Slave. In the virtual machine, I add the path to the MSBuild I want to use :

    %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\;
    

    I added also the path to NUnit :

    C:\Program Files\NUnit 2.5.7\bin\net-2.0;
    

    And so, I can run the NUnit and MSBuild command lines in my VM.

    But I get this error when my Hudson Job build my solution :

    C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "nunit.framework".
    

    What should I fix in my VM or in Hudson? Thank you a lot!

    EDIT

    Here how the concerned file *.csproj references to the dll :

    <Reference Include="nunit.framework, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=KKKKKKKKKK processorArchitecture=KKK">
        <SpecificVersion>False</SpecificVersion>
        <HintPath>Dll\nunit.framework.dll</HintPath>
    </Reference>
    
  • Farah
    Farah over 10 years
    The project is very well coded. I built the solution according to each configuration (AnyCPU,Win32,x64) by Visual Studio 2008 graphically and it was generated successfuly. But when I build it remotely from Hudson, it fails to find the reference to that dll
  • granadaCoder
    granadaCoder over 10 years
    Post your csproj code (open it in notepad). .. and post the section that has the nunit reference.
  • Fantastory
    Fantastory over 9 years
    Could not get it to work without hint path i just hardcoded default nunit install path: <HintPath>C:\Program Files (x86)\NUnit 2.6.3\bin\nunit.framework.dll</HintPath>
  • granadaCoder
    granadaCoder about 8 years
    The Identity that runs the build-process.......must have access to that directory. And giving the Identity that runs the build-process......permissions to "c:\program files\" (or similar) is not a best practice IMHO.