public ITaskExtensionsFluentInterface GenerateCommonAssemblyInfo(Action <GenerateCommonAssemblyInfoTask> action = null)
        {
            string buildConfiguration      = Context.Properties.Get <string>(BuildProps.BuildConfiguration);
            string companyCopyright        = Context.Properties.Get(BuildProps.CompanyCopyright, string.Empty);
            string companyName             = Context.Properties.Get(BuildProps.CompanyName, string.Empty);
            string companyTrademark        = Context.Properties.Get(BuildProps.CompanyTrademark, string.Empty);
            string productId               = Context.Properties.Get <string>(BuildProps.ProductId);
            string productName             = Context.Properties.Get(BuildProps.ProductName, productId);
            bool   generateAssemblyVersion = Context.Properties.Get(BuildProps.AutoAssemblyVersion, true);

            GenerateCommonAssemblyInfoTask task = Context.Tasks().GenerateCommonAssemblyInfoTask()
                                                  .BuildConfiguration(buildConfiguration)
                                                  .CompanyCopyright(companyCopyright)
                                                  .CompanyName(companyName)
                                                  .CompanyTrademark(companyTrademark)
                                                  .GenerateConfigurationAttribute(true)
                                                  .ProductName(productName);

            if (Context.Properties.Has(BuildProps.InformationalVersion))
            {
                task.InformationalVersion(Context.Properties.Get <string>(BuildProps.InformationalVersion));
            }

            task.ProductVersionFieldCount(Context.Properties.Get(BuildProps.ProductVersionFieldCount, 2))
            .GenerateAssemblyVersion(generateAssemblyVersion);

            action?.Invoke(task);
            Target.Target.AddTask(task);

            return(this);
        }
Пример #2
0
        public static void TargetGenerateCommonAssemblyInfo(ITaskContext context)
        {
            string  buildConfiguration      = context.Properties.Get <string>(BuildProps.BuildConfiguration);
            Version buildVersion            = context.Properties.Get <Version>(BuildProps.BuildVersion);
            string  companyCopyright        = context.Properties.Get(BuildProps.CompanyCopyright, String.Empty);
            string  companyName             = context.Properties.Get(BuildProps.CompanyName, String.Empty);
            string  companyTrademark        = context.Properties.Get(BuildProps.CompanyTrademark, String.Empty);
            string  productId               = context.Properties.Get <string>(BuildProps.ProductId);
            string  productName             = context.Properties.Get(BuildProps.ProductName, productId);
            string  productRootDir          = context.Properties.Get(BuildProps.ProductRootDir, ".");
            bool    generateAssemblyVersion = context.Properties.Get(BuildProps.AutoAssemblyVersion, true);

            GenerateCommonAssemblyInfoTask task = new GenerateCommonAssemblyInfoTask(productRootDir, buildVersion);

            task.BuildConfiguration             = buildConfiguration;
            task.CompanyCopyright               = companyCopyright;
            task.CompanyName                    = companyName;
            task.CompanyTrademark               = companyTrademark;
            task.GenerateConfigurationAttribute = true;
            task.ProductName                    = productName;

            if (context.Properties.Has(BuildProps.InformationalVersion))
            {
                task.InformationalVersion = context.Properties.Get <string>(BuildProps.InformationalVersion);
            }

            task.ProductVersionFieldCount = context.Properties.Get(BuildProps.ProductVersionFieldCount, 2);
            task.GenerateAssemblyVersion  = generateAssemblyVersion;
            task.Execute(context);
        }