我的任务是在.xaml文件上利用stylecop。有没有人有一个好的地方开始寻找最好的方法来完成这项任务。我已经在互联网上闲逛了,还没有找到一个好的解决方案。我们的开发环境是VS 2010 WPF应用程序。
感谢您的帮助。
最佳答案
StyleCop是一种源代码分析工具,可以提高其可读性。 Visual Studio本身将是一个不错的起点。当您开始使用VS编写xaml时,它会自动缩进代码。
这是一个例子
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Hi" />
</Grid>
</Window>
这是预期的(我认为)
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Hi" />
</Grid>
</Window>
关于wpf - 如何将Stylecop与.xaml文件一起使用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6111526/