gpt4 book ai didi

c# - 让 VS 突出显示所有 .Net 3.5 SP1 方法调用

转载 作者:行者123 更新时间:2023-11-30 22:49:39 24 4
gpt4 key购买 nike

.Net 3.5 SP1 中有一堆新的 API。

如果不卸载 .Net 3.5 SP1(或在 VM 上进行开发),有没有办法让 VS 2008 以 .Net 3.5(RC) 为目标而不是 .Net 3.5 SP1?

当调用 3.5 SP1 中不支持的 API 时,有没有办法让它发出警告?

类似问题:Find code that depends on .NET 3.5 SP1

最佳答案

这实际上有一个非常棘手的答案。

首先,要获得 the following post 中概述的功能您将需要最新版本的 fxcop 或 VS 2008 SP1。

一旦你安装了它,就会有一个新规则(在 VS 2008 Team System 中)称为可移植性规则 -> 仅使用来自目标框架的 API。

但这还不够

Fxcop 当前附带了不可靠的 wpf 规则:

引用上面帖子的最后一行:

It seems like there are bugs in this because it didn't complain when I referenced IEditableCollectionView which was added in 3.5 SP1. As a matter of fact, it seems like "C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Repository\Compatibility\Desktop3.5SP1.xml" doesn't list ANY of the new WPF assembly members.

Andrew, thanks for the feedback. You are correct, there is a bug. The data for WPF 3.5 SP1 is included, it's just listed under 3.0 SP2. However, the 'Priority' attribute for this file and 2.0 SP2 is incorrect. I've forwarded this information on to my old team, in meantime, a workaround is to manually change these files; for Desktop3.0SP2.xml change the priority from '3020' to '3520' and for Desktop2.0SP2.xml change the priority from '3015' to '3515'.

所以如果你想让它工作,你需要在管理员中破解打开 cmd 并修复这些文件。

一旦完成,它似乎工作正常。

关于c# - 让 VS 突出显示所有 .Net 3.5 SP1 方法调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1030356/

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