gpt4 book ai didi

c# - 如何将 PresentationFramework 加载到我的 xUnit 测试中?

转载 作者:行者123 更新时间:2023-12-04 14:18:09 26 4
gpt4 key购买 nike

实际上很难在网上搜索类似的案例。所以我决定在这里问一下。

在我的测试项目中,我的 SUT 引用了 PresentationFramework来自 Assembly引用标签,目标框架是.NET Framework 4.8 .

因为我正在使用 xUnit , 我的目标框架是 .NET Core 2.2在运行我的测试时,我收到了测试消息:

Message: System.IO.FileNotFoundException : Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

实际上我不确定如何添加 PresentationFramework.NET Core ,或者我应该将测试项目的目标框架更改为 .NET Framework 4.8

最佳答案

我有同样的问题,我修改了xunit测试项目的csproj来指定Windows SDK和WPF

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<IsPackable>false</IsPackable>
</PropertyGroup>
...

关于c# - 如何将 PresentationFramework 加载到我的 xUnit 测试中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58096117/

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