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

…衆ロ難τιáo~ 提交于 2019-12-23 09:30:53

问题


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>

回答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."




回答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).



来源:https://stackoverflow.com/questions/20427612/hudson-warning-msb3245-could-not-locate-the-assembly-nunit-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!