代码改变世界

An easier way to register the Assemblies' Instrumentation In Enterprise Library[转]

  无常  阅读(735)  评论(0编辑  收藏  举报

An easier way to register the Assemblies' Instrumentation In Enterprise Library

I know that we have a link on the start menu to run the batch file that registers all the assemblies instrumentation, but there is an easier way.   The batch file (Install Services.bat) requires that you have VS installed and assumes that you have it installed in the default location (C:\Program Files\…). Actually all you really need is installutil on the path.  If it got shipped, in the Common\Instrumentation\Scripts folder, there are two files called Install Instrumentation.cad and UninstallInstrumenation.cad.  Now we used this during development to register the assemblies.  You could modify this to register your assemblies at deployment time.   The parameter you pass to the script is the output directory you built the assemblies to.  For example if you built the Debug version of the library, you would run InstallInstrumentation.cmd Debug.

Since I don’t know if you guys have the files. I will post them here:

InstallInstrumentation.cmd
@echo off

echo ==================================================
echo Installing Common Instrumentation
echo ==================================================
installutil ..\..\bin\%1\Microsoft.Practices.EnterpriseLibrary.Common.dll

echo ==================================================
echo Installing Configuration Instrumentation
echo ==================================================
installutil ..\..\bin\%1\Microsoft.Practices.EnterpriseLibrary.Configuration.dll

echo ==================================================
echo Installing Data Instrumentation
echo ==================================================
installutil ..\..\..\Data\bin\%1\Microsoft.Practices.EnterpriseLibrary.Data.dll

echo ==================================================
echo Installing Caching Instrumentation
echo ==================================================
installutil ..\..\..\Caching\bin\%1\Microsoft.Practices.EnterpriseLibrary.Caching.dll

echo ==================================================
echo Installing Logging Instrumentation
echo ==================================================
installutil ..\..\..\Logging\bin\%1\Microsoft.Practices.EnterpriseLibrary.Logging.dll

echo ==================================================
echo Installing Logging Instrumentation Tests
echo ==================================================
installutil ..\..\..\Logging\Sinks\WMISchema\bin\%1\Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.WMISchema.Tests.dll

echo ==================================================
echo Installing ExceptionHandling Instrumentation
echo ==================================================
installutil ..\..\..\ExceptionHandling\bin\%1\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll

echo ==================================================
echo Installing Security Instrumentation
echo ==================================================
installutil ..\..\..\Security\bin\%1\Microsoft.Practices.EnterpriseLibrary.Security.dll

echo ==================================================
echo Installing Security Cryptography Instrumentation
echo ==================================================
installutil ..\..\..\Security\Cryptography\bin\%1\Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll

UninstallInstrumenation.cmd
@echo off

echo ==================================================
echo Uninstalling Common Instrumentation
echo ==================================================
installutil /u ..\..\bin\%1\Microsoft.Practices.EnterpriseLibrary.Common.dll

echo ==================================================
echo Uninstalling Configuration Instrumentation
echo ==================================================
installutil /u ..\..\bin\%1\Microsoft.Practices.EnterpriseLibrary.Configuration.dll

echo ==================================================
echo Uninstalling Data Instrumentation
echo ==================================================
installutil /u ..\..\..\Data\bin\%1\Microsoft.Practices.EnterpriseLibrary.Data.dll

echo ==================================================
echo Uninstalling Caching Instrumentation
echo ==================================================
installutil /u ..\..\..\Caching\bin\%1\Microsoft.Practices.EnterpriseLibrary.Caching.dll

echo ==================================================
echo Uninstalling Logging Instrumentation
echo ==================================================
installutil /u ..\..\..\Logging\bin\%1\Microsoft.Practices.EnterpriseLibrary.Logging.dll

echo ==================================================
echo Installing Logging Instrumentation Tests
echo ==================================================
installutil /u ..\..\..\Logging\Sinks\WMISchema\bin\%1\Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.WMISchema.Tests.dll

echo ==================================================
echo Uninstalling ExceptionHandling Instrumentation
echo ==================================================
installutil /u ..\..\..\ExceptionHandling\bin\%1\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll

echo ==================================================
echo Uninstalling Security Instrumentation
echo ==================================================
installutil /u ..\..\..\Security\bin\%1\Microsoft.Practices.EnterpriseLibrary.Security.dll

echo ==================================================
echo Uninstalling Security Cryptography Instrumentation
echo ==================================================
installutil /u ..\..\..\Security\Cryptography\bin\%1\Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll


from: http://blogs.msdn.com/scottdensmore/archive/2005/03/17/397950.aspx

编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示