有这个问题,主要是几个原因
1:最近发现在项目引用中,出现引用了DEBUG版本的DLL,所以我需要区分一个DLL是Release、还是Debug版本(方法)
2:有了方法,就要改AssemblyInfo信息了。这里是没办法用查找、替换的方式来实现。最后用了宏,来完成对AssemblyDescription这个标签的批量修改。
<!---->Public Module RecordingModule
Sub TemporaryMacro()
DTE.ExecuteCommand("Edit.FindinFiles")
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Activate() '查找和替换
DTE.Find.FilesOfType = "Assemblyinfo.cs"
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
DTE.Find.FindWhat = "[assembly: AssemblyDescription("""")]"
DTE.Find.Target = vsFindTarget.vsFindTargetFiles
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.SearchPath = "整个解决方案"
DTE.Find.SearchSubfolders = True
DTE.Find.FilesOfType = "Assemblyinfo.cs"
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
DTE.Find.Action = vsFindAction.vsFindActionFindAll
If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
System.Threading.Thread.Sleep(1000)
Dim reg As New Regex("匹配文件: (\d*)")
Dim match = reg.Match(DTE.StatusBar.Text)
If match.Success Then
For i = 1 To Convert.ToInt32(match.Groups(1).Value)
DTE.Windows.Item(Constants.vsWindowKindFindResults1).Activate()
DTE.ExecuteCommand("Edit.GoToFindResults1NextLocation")
DTE.Windows.Item("AssemblyInfo.cs [只读]").Activate() '如果你没有使用VSS版本控制直接修改成 DTE.Windows.Item("AssemblyInfo.cs")
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.DeleteLeft()
DTE.ActiveDocument.Selection.Text = "#if DEBUG"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "[assembly: AssemblyDescription(""Debug"")]"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "#else"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "[assembly:AssemblyDescription(""Release"")]"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "#endif"
Next
End If
End Sub
End Module
分享到:
相关推荐
.net 读取项目AssemblyInfo.cs属性值的实现代码。
取得系统的版本号 取得系统的版本 取得系统的版本号 取得系统的版本号
这份文档是讲述 AssemblyInfo文件参数一些具体说明
Example.vcproj 这是用应用程序向导生成的 VC++ 项目的主项目文件。 它包含有关生成此文件的 Visual C++ 版本的信息,以及 有关使用应用程序向导选择的 ... 包含用于修改程序集元数据的自定义属性。
MD5 skey8位加密(文件)/My Project/AssemblyInfo.vb MD5 skey8位加密(文件)/My Project/Resources.Designer.vb MD5 skey8位加密(文件)/My Project/Resources.resx MD5 skey8位加密(文件)/My Project/...
ProjectScaffold该项目可用于构建原型.NET解决方案,包括文件系统布局和工具。 这包括一个构建过程,该过程:更新所有AssemblyInfo文件,以编译应用程序和ProjectScaffold。此项目可用于构建原型.NET解决方案,包括...
vbs 批量修改文件,bat 批处理文件调用执行vbs,并在cmd窗口打印返回值(vbs运行结果) 使用vbs 脚本对工作目录下的字符串进行替换并统计被修改的文件数主调的批处理方法将捕捉该vbs脚本运行后的结果并打印在cmd...
AssemblyInfo.cs 人工智能领域
AssemblyInfo.cs
便携式 .NET 框架 对于开发者 更改版本号 在两个文件中更改版本 Framework.G1\Framework.G1\AssemblyInfo.cs Framework.G1\Framework.G1_CreateNewNuGetPackages\Config.ps1 想法 来自 Git 的汇编版本 Major....
AssemblyInfoLibrary:在基于.NET Core 5.0的类库中获取并显示程序集属性
3.2.1 AssemblyInfo.cs 文件..... 24 3.2.2 Global.asax 文件... 24 3.2.3 Global.asax.cs 文件......... 25 3.3 处理事件... 25 3.3.1 建立预定事件. 25 IV .NET移动通信程序设计 3.3.2 建立非预定事件... 26...
该小工具用于查看dll信息,有源代码,可以直接运行----.net4.0环境,vs2010, 这个是为了http://blog.csdn.net/cdnight/article/details/9148545这篇 文章而做的小工具。
08.剖析 AssemblyInfo.cs - 了解常用的特性 Attribute.pdf 08.剖析 AssemblyInfo.cs - 了解常用的特性 Attribute.pdf
本文件概要介绍组成 显示数据库信息 应用程序的每个文件的内容。 显示数据库信息.vcproj 这是使用应用程序向导生成的 VC++ 项目的主项目文件。 它包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序...
用C#语言实现http协议下的多线程文件传输VC源代码
使用 xUnit.benchmark 进行性能测试xUnit.benchmark是一个... 将以下行添加到测试项目中的 AssemblyInfo.cs 文件以启用 xUnit.benchmark。 [ assembly : Xunit . TestFramework ( " Microsoft.Xunit.BenchmarkTestFr