测试多个版本的Nuget的最简单方法是什么?

发布于 2025-01-24 20:24:25 字数 353 浏览 2 评论 0原文

我有两个C#项目。项目A是Nuget软件包。项目B是网络服务。项目A调用Web服务。

我们希望B(Web Serice)与A -IE的旧版本保持向后兼容

。这很容易为A的单个版本进行测试 - 只需在测试项目中安装Nuget软件包,然后针对Web服务的实例运行一些测试即可。

对于多个版本的Nuget,最方便的方法是什么?我无法轻松地引用多个版本的nuget,并在运行时切换它们。当然,我可以进行多个测试项目并在每个测试项目中引用不同的Nuget版本,但是我是否必须在多个项目中复制测试?那将是非常不便的。

有一个不错的方法吗?我可以使用预处理器指令做一些聪明的事情,并通过同一源代码构建不同的DLL?还是什么?

提前致谢!

I have two C# projects. Project A is a NuGet package. Project B is a web service. Project A calls the web service.

We want B (the web serice) to remain backward-compatible with old versions of A - i.e., old versions of A can still call the newest version of B.

I want to write integration tests to verify this. This is easy enough to test for a single version of A - just install the NuGet package in a test project and run some tests against an instance of the web service.

What is the most convenient way to do this for multiple versions of the NuGet? I cannot easily reference multiple versions of a NuGet and switch between them at runtime. Of course I can make multiple test projects and reference a different NuGet version in each test project, but do I then have to copy the tests themselves across multiple projects? That would be very inconvenient.

Is there a nice way to do this? Can I maybe do something clever with preprocessor directives and build different DLLs from the same source code? Or something?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文