قبل از آن بد نیست که بدانید چرا این ابزار T4 نام گرفته !
T4 مخفف Text Template Transformation Toolkit میباشد (TTTT). شکل زیر مراحل اجرای یک کد Text Template را توسط T4 نشان میدهد:
برای آزمایش، یک فایل متنی کنار فایل TextTransform.exe با نام Text2.tt ایجاد نمایید و کد زیر را در داخل آن بنویسید:
<#@ template debug="true" hostspecific="false" language="C#" #> <#@ output extension=".txt" #> <#@ import namespace="System.Diagnostics" #> Report In : <#= DateTime.Now #> <# Process[] Procs = Process.GetProcesses(); for (int i = 0; i < Procs.Length; i++) { string Pstr = Procs[i].ProcessName + " -|- " + Procs[i].Id + Environment.NewLine ; #><#= Pstr #><# } #>
برای تولید فایل خروجی، دستور زیر را در cmd.exe اجرا کنید :
نکته: اگر User شما به این پوشه دسترسی ندارد و کاربر Admin نیستید احتمالا به مشکل بر میخورد. میتوانید فایل TextTransform.exe را در مکان دیگری قرار دهید و دستور را از آن محل اجرا کنید و یا برای پوشهی مذکور دسترسی ایجاد نمایید.
اگر میخواهید بیشتر در مورد معماری T4 بدانید بهتر است مقاله زیر را مطالعه کنید:
http://www.olegsych.com/2008/05/t4-architecture/
نکته دیگر این که برای Visual Studio، ابزارهایی جهت بهبود کار با Text Templateها وجود دارند که با جستجوی T4 Editor، نمونههایی از آنها را خواهید یافت. tangible T4 Editor نمونه ای از این Pluginها میباشد که به Visual Studio افزوده میگردد و یا یک پروژه Open Source هم برای آشنایی بسیار بیشتر با T4 در t4toolbox.codeplex.com وجود دارد که میتوانید مشاهده کنید.انتشار PostSharp 6.0 RC
PostSharp 6.0 is the biggest refactoring since the 2.0 version released in July 2010. For a good cause: PostSharp 6.0 now runs natively in .NET Core 2.0. Previous versions of PostSharp executed only under .NET Framework at build time and the support for .NET Core was achieved by using a load of hacks that ended up being unmaintainable, warranting this big refactoring.
Let’s have a look at the new features of PostSharp 6.0 :
- Support for .NET Core 2.0-2.1 and .NET Standard 2.0.
- Support for Portable PDB.
- Support for C# 7.2.
- Ending the PostSharp versioning hell side-by-side: backward compatibility within the same major version.
- Logging: robustness to faults in the logging subsystem.
- Logging: no need to initialize before the first logged method is hit.
- Caching: preventing concurrent execution (locking).
- Visual Studio tooling: support for the new CPS-based project systems.
- GDPR compliance: we no longer collect your name and email for trial, nor use unsecure HTTP, nor use non-resettable user id hashes.
Now you can upgrade any .NET application to the latest version of .NET inside of Visual Studio! We are happy to introduce it as a Visual Studio extension and will upgrade your .NET Framework or .NET Core web- and desktop apps. In this video, Olia shows you how to get the extension and start to update your projects to the latest version of NET in minutes.
we’re releasing a special Installer of Visual Studio Code for Java developers. The package can be used as a clean install or an update for existing environment to add Java or Visual Studio Code to your development environment.
In short, we’re making Xamarin’s cross-platform tools available in
Visual Studio, from Community up through Enterprise at no additional
cost and we’re open-sourcing the Xamarin SDK – the core of the Xamarin
toolchain. In addition, we’re making Xamarin’s services (for example,
Test Cloud and Xamarin University) available along with the existing
Microsoft mobile DevOps capabilities.
https://blog.xamarin.com/xamarin-for-all/?utm_medium=social&utm_campaign=blog&utm_source=twitter&utm_content=xamarin-for-all
Today we are excited to announce the preview of the Microsoft Build of OpenJDK, a new no-cost Long-Term Support (LTS) distribution of OpenJDK that is open source and available for free for anyone to deploy anywhere. It includes binaries for Java 11, based on OpenJDK 11.0.10+9, on x64 server and desktop environments on macOS, Linux, and Windows. We are also publishing a new Early Access binary for Java 16 for Windows on ARM, based on the latest OpenJDK 16+36 release.