gpt4 book ai didi

msbuild - 升级后 NUnit 在 MSBuild 中运行失败 - System.IO.FileLoadException : Could not load file or assembly nunit. 框架

转载 作者:行者123 更新时间:2023-12-02 03:36:33 27 4
gpt4 key购买 nike

我最近将我的解决方案升级到 Visual Studio 2013,并在测试库中从 2.6.2 更新了对 NUnit 2.6.3 的引用。在 Visual Studio 中一切正常,但我驱动部署系统的 MSBuild 脚本完全无法运行。

构建文件位于一个构建目录中,该目录包含一个 MSBuild 文件夹,其中包含引用的 MSBuild.Community.Targets 文件,以及一个包含 nunit-console.exe 和各种依赖文件的 NUnit 目录。我也将它们升级到 2.6.3。

我刚收到这个错误...

' System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) '

我完全不明白 - 这之前工作正常并且所有代码都引用 2.6.2 所以我不知道 2.6.0 来自哪里或者我到底是如何告诉它寻找 2.6.3 (就在那里!!)

这是我的构建文件(如果有帮助的话)...

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DeployAndPackage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- IMPORTS -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\MSBuild\MSBuild.Community.Tasks.targets" />
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<!-- PROPERTIES -->
<PropertyGroup Label="BuildOptions">
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
<OutputPath Condition=" '$(OutputPath)' == '' ">bin\</OutputPath>
<ProjectConfiguration Condition=" '$(Configuration)' == '' ">Debug</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Test' ">Debug</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Staging' ">Release</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Live' ">Release</ProjectConfiguration>
</PropertyGroup>
<PropertyGroup Label="DirectoryPaths">
<RootDir>$(MSBuildProjectDirectory)\..\</RootDir>
<TestsDir>$(RootDir)Tests\</TestsDir>
<DatabaseDir>$(RootDir)SiansPlan.Database\</DatabaseDir>
<RelativePackageDir>$(RootDir)pkg\</RelativePackageDir>
<Solution>$(RootDir)SiansPlan.sln</Solution>
<SP_Auth>$(RootDir)SiansPlan.Authentication\SiansPlan.Authentication.csproj</SP_Auth>
<SP_Database>$(DatabaseDir)SiansPlan.Database.sqlproj</SP_Database>
<SP_Entities>$(RootDir)SiansPlan.Entities\SiansPlan.Entities.csproj</SP_Entities>
<SP_Domain>$(RootDir)SiansPlan.Domain\SiansPlan.Domain.csproj</SP_Domain>
<SP_Providers>$(RootDir)SiansPlan.Providers\SiansPlan.Providers.csproj</SP_Providers>
<SP_ApiDir>$(RootDir)SiansPlan.Api\</SP_ApiDir>
<SP_Api>$(SP_ApiDir)SiansPlan.Api.csproj</SP_Api>
<SP_Web>$(RootDir)SiansPlan.Web\SiansPlan.Web.csproj</SP_Web>
<SP_SpaDir>$(RootDir)SiansPlan.Spa\</SP_SpaDir>
<SP_Spa>$(SP_SpaDir)SiansPlan.Spa.csproj</SP_Spa>
<SP_Test_Support>$(TestsDir)SiansPlan.TestSupport\SiansPlan.TestSupport.csproj</SP_Test_Support>
<SP_Entities_Tests>$(TestsDir)SiansPlan.Entities.Tests\SiansPlan.Entities.Tests.csproj</SP_Entities_Tests>
<SP_Auth_Tests>$(TestsDir)SiansPlan.Authentication.Tests\SiansPlan.Authentication.Tests.csproj</SP_Auth_Tests>
<SP_Domain_Tests>$(TestsDir)SiansPlan.Domain.Tests\SiansPlan.Domain.Tests.csproj</SP_Domain_Tests>
<SP_Api_Tests>$(TestsDir)SiansPlan.Api.Tests\SiansPlan.Api.Tests.csproj</SP_Api_Tests>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>2ae13924-f2dd-48b1-9acb-755e0ee2b0d1</ProjectGuid>
</PropertyGroup>
<!-- BUILD -->
<Target Name="Compile">
<MSBuild Projects="$(SP_Auth)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Database)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Entities)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Domain)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Providers)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Api)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Web)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Spa)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Test_Support)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Entities_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Auth_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Domain_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Api_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
</Target>
<!-- TEST -->
<Target Name="RunTests" DependsOnTargets="Compile">
<CreateItem Include="$(RootDir)Tests\*.Tests\bin\*.Tests.dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(MSBuildProjectDirectory)\NUnit" DisableShadowCopy="true" />
</Target>
<!-- TRANSFORM -->
<Target Name="Transform">
<TransformXml Source="$(SP_ApiDir)\Web.config"
Transform="$(SP_ApiDir)\Web.$(Configuration).config"
Destination="$(SP_ApiDir)\Web.transformed.config"
StackTrace="False" />
<TransformXml Source="$(SP_SpaDir)\Web.config"
Transform="$(SP_SpaDir)\Web.$(Configuration).config"
Destination="$(SP_SpaDir)\Web.transformed.config"
StackTrace="False" />
</Target>
<!-- DEPLOY & PACKAGE -->
<Target Name="DeployAndPackage" DependsOnTargets="RunTests">
<CallTarget Targets="Transform"/>
<ItemGroup>
<SqlFiles Include="$(DatabaseDir)Upgrades\*.sql" />
</ItemGroup>
<RemoveDir Directories="$(RelativePackageDir)" />
<MakeDir Directories="$(RelativePackageDir)" />
<MakeDir Directories="$(RelativePackageDir)sql\" />
<Copy SourceFiles="@(SqlFiles)" DestinationFolder="$(RootDir)pkg\sql" />
</Target>
</Project>

构建的“RunTests”部分的完整输出是...

RunTests:

C:\Development\Clients\SiansPlan\source\build\NUnit\nunit-console.exe /nologo /noshadow C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Api.Tests\bin\SiansPlan.Api.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Api.Tests\bin\SiansPlan.Domain.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Authentication.Tests\bin\SiansPlan.Authentication.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Domain.Tests\bin\SiansPlan.Domain.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Entities.Tests\bin\SiansPlan.Entities.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Logging.Tests\bin\SiansPlan.Domain.Tests.dll C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Logging.Tests\bin\SiansPlan.Logging.Tests.dll ProcessModel: Default DomainUsage: Multiple Execution Runtime: net-4.5 Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'

任何想法都将受到欢迎,因为我正站在桌面舞台上。我问过我的小熊、我的橡皮鸭和 Soundwave,坦率地说,它们都没有多大用处!

最佳答案

一个晦涩问题的晦涩答案 - 似乎我有一个旧图书馆闲逛(Domain.Tests in Logging 是一个赠品)导致它倒下。

清理失败

关于msbuild - 升级后 NUnit 在 MSBuild 中运行失败 - System.IO.FileLoadException : Could not load file or assembly nunit. 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23141159/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com