gpt4 book ai didi

c# - 在 c# 项目中定义了 'private accessors'

转载 作者:太空狗 更新时间:2023-10-29 21:32:34 27 4
gpt4 key购买 nike

在 Visual Studio 2015 中构建遗留 C# 应用程序后,出现以下警告:

This task to create private accessor is deprecated and will be removed in a future version of visual studio.

警告引用了解决方案中仅包含单元测试的项目。

Microsoft 文档说明:

Previous versions of Visual Studio, you could use Publicize.exe to specify an internal application programming interfaces (API) and create public counterpart API that you can call in your tests, which would in turn, call into the internal APIs of your product. You could then use code generation to create test stubs and generate code snippet inside that stub.

此功能已在 Visual Studio 2012 中删除。

搜索解决方案,在任何构建文件中都没有对 publicize.exe 的引用。

在 C# 项目中的哪个位置定义创建私有(private)访问器的任务?

最佳答案

您应该在单元测试项目的 .csproj 文件中找到访问器。

在 Visual Studio 中,右键单击您的测试项目并选择“卸载项目”。然后再次右键单击项目并选择“Edit project-name.csproj

访问器看起来像这样:

  <ItemGroup>
<Shadow Include="Test References\some-name.accessor" />
</ItemGroup>

关于c# - 在 c# 项目中定义了 'private accessors',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39436276/

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