When developing a project recently, I planned to use NDoc to generate help documentation for the class library. I downloaded the Chinese version 1.3 of Percyboy. The documentation said it supports .net2.0. However, when using it, I found that an exception occurred when applying NDoc to create a new NDoc project from the solution, and the help document could not be successfully generated.
Download the source program, use vs.net2005 conversion to open the ndoc solution for debugging, modify the bug, and pass the debugging. The relevant bugs and solutions are recorded as follows. If you want to use NDoc to generate the help file of the assembly generated by vs.net , can be handled accordingly.
1. If the project in the solution is in a directory with a Chinese name, the exception thrown cannot be handled. The reason is that when ndoc parses the solution file, it uses UTF encoding to open the solution file, resulting in Chinese characters not being processed correctly. Solution: Open the solution file under the gui project, locate the read method, and use (reader=new StreamReader(path)) to open the file using (reader=new StreamReader(path,System.Text.Encoding.GetEncoding(0) )))replace. For specific usage of StreamReader, please refer to msdn.
2. When parsing project files, the project files generated by vs.net2005 are essentially xml files, but some have <?xml version="1.0" encoding="utf-8"?> tags, and some project files do not, for unknown reasons. , and I don’t have time to analyze the specific reasons. If anyone knows, please tell me. This leads to the need to process project files on a case-by-case basis. I analyzed ndoc's original idea and this is also the case. Maybe the formats of the two project files in versions before 2005 were different, so ndoc processed it on a case-by-case basis when parsing the project files. However, although there are differences in the project files generated with vs.net2005, the format is the same and does not need to be processed on a case-by-case basis. Solution: Open the project file under the gui project, locate GetConfiguratin(string configName), and change the following code:
if (_ProjectDocument.FirstChild.Name == "Project")
{
nodes = _ProjectNavigator.Select(string.Format("VS2005:Project/VS2005:PropertyGroup[@Condition=" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' "]", configName ), _ProjectNamespaceManager);
}
else
{
nodes = _ProjectNavigator.Select(String.Format("/VisualStudioProject/CSHARP/Build/Settings/Config[@Name='{0}']", configName));
}
Replace with:
nodes = _ProjectNavigator.Select(string.Format("VS2005:Project/VS2005:PropertyGroup[@Condition=" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' "]", configName ), _ProjectNamespaceManager);
After doing the above processing and passing the compilation, using ndoc's function to create a new ndoc project from a .net solution can be processed normally, but I don't know if this processing will have any adverse effects on the solutions generated by versions before 2005. Impact, however, the launch time of 2005 is not short, and most projects should have been migrated to 2005, so the impact should not be significant.
http://www.cnblogs.com/yxy21969/archive/2006/11/28/575257.html