我在服务层有接口,有几个方法,从Get和FxCop的Use属性开始,适当的规则抱怨我应该考虑使用属性.
我尝试使用SuppressMessageAttribute,但是当它在接口上定义时,它对成员方法没有影响.我是否需要将SuppressMessageAttribute放到每个方法中,还是有办法抑制整个类型的CA1024?
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate"]
public interface IProjectService
{
// Information and statistics about projects
IList<ProjectInfo> GetProjects();
ProjectsDashboard GetProjectsDashboard();
// Project's settings
ProjectSettings GetProjectSettings(Guid id);
void SaveProjectSettings(ProjectSettings settings);
}
Run Code Online (Sandbox Code Playgroud) 我有几个自定义MSBuild项目文件<ProjectReferences>.我正在调用<MSBuild Projects="@(ProjectReference)" Targets="Build">任务,我可以使用该<Output TaskParameter="TargetOutputs" ItemName="OutputAssemblies" />元素获取所有构建的程序集,并且我将@(OutputAssemblies)复制到目标目录.
我希望能够从ResolveAssemblyReferences目标获取@(ReferenceCopyLocalPaths)项属性,但我无法弄清楚如何输出此属性.
<Target Name="BuildDocumentationForReferencedProjects">
<MSBuild
Projects="@(ProjectReference)"
Targets="Build"
BuildInParallel="true"
Properties="DocumentationFile=$(DllDir)\%(FileName).xml"
>
<Output TaskParameter="TargetOutputs" ItemName="OutputAssemblies" />
</MSBuild>
<Copy SourceFiles="@(OutputAssemblies)" DestinationFolder="$(DllDir)" />
</Target>
Run Code Online (Sandbox Code Playgroud)