简体   繁体   中英

how to find <import> tag in .csproj file?

I am using visual c# 2010 Express and I am to use stylecop. I read article on http://stylecop.codeplex.com/wikipage?title=Running%20StyleCop%20in%20VS2005%20or%20VS%20Express .

I am unable to find <import> tag. Within the csproj file, how to find the import tag which imports the Microsoft.CSharp.targets file,

and how to insert a new import to link to the StyleCop.Targets file

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
<Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.4\StyleCop.targets"/>

If any one find please help me on this.

In the Solution Explorer:

  • Right click on your project, select Unload project .
  • Right click on the project again and select Edit project .
  • .csproj file will be open as XML.
  • After you are done editing the file, right click on the project and select Reload Project .

On your windows explorer,

  • right click on the project file and
  • select open with
  • select notepad

there it solves your problem

You mention only the Project tag is used. The Import property is a child of project, so you should be able to do this (taken from the StyleCop website you linked)

Note that the project tag was opened " /> becomes > " and a closing </project> is added.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(STYLECOPTOOLS)\v4.4\StyleCop.Targets" />
</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM