This blog has been moved to the Octopress plus Github Pages and can now be accessed by sklyarenko.net. The contents of this Blogger instance will continue living here in order not to break the external references.
The AI ick
1 day ago
This blog is used as a memory dump of random thoughts and interesting facts about different things in the world of IT. If anyone finds it useful, the author will be just happy! :-)
<copy todir="${target}">
<fileset basedir="${source}" />
</copy>
[copy] Copying 1 directory to '...'.
[copy] Copying 0 files to '...'.
<copy todir="${target}">
<fileset basedir="${source}">
<include name="**/*" />
</fileset>
</copy>
[exec] SignTool Error: SignedCode::Sign returned error: 0x800700C1 [exec] Either the file being signed or one of the DLL specified by /j switch is not a valid Win32 application. [exec] SignTool Error: An error occurred while attempting to sign: D:\output\setup.exe
“The type or namespace name 'Linq' does not exist in the namespace 'System' ”.
[exec] Microsoft (R) Build Engine Version 3.5.30729.5420 [exec] [Microsoft .NET Framework, Version 2.0.50727.5456] [exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
"A reference to 'System.Core' could not be added. This component is already automatically referenced by the build system"
<Reference Include="System.Core" />
[TaskAttribute("param", Required = true), StringValidator(AllowEmpty = false)]
public string Param { get; set; }
[TaskAttribute("port"), Int32Validator(1000, 65520), DefaultValue(16333)]
public int Port { get; set; }
/// <summary>
/// The custom attribute for the task attribute default value
/// </summary>
public class DefaultValueAttribute : Attribute
{
public DefaultValueAttribute(object value)
{
this.Default = value;
}
public object Default { get; set; }
}
public abstract class DefaultValueAwareTask : Task
{
protected override void ExecuteTask()
{
this.SetDefaultValues();
}
protected virtual void SetDefaultValues()
{
foreach (var property in GetPropertiesWithCustomAttributes<DefaultValueAttribute>(this.GetType()))
{
var attribute = (TaskAttributeAttribute)property.GetCustomAttributes(typeof(TaskAttributeAttribute), false)[0];
var attributeDefaultValue = (DefaultValueAttribute)property.GetCustomAttributes(typeof(DefaultValueAttribute), false)[0];
if (attribute.Required)
{
throw new BuildException("No reason to allow both to be set", this.Location);
}
if (this.XmlNode.Attributes[attribute.Name] == null)
{
property.SetValue(this, attributeDefaultValue.Default, null);
}
}
}
private static IEnumerable<PropertyInfo> GetPropertiesWithCustomAttributes<T>(Type type)
{
return type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance).Where(property => property.GetCustomAttributes(typeof(T), false).Length > 0);
}
}
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
<#@ template language="cs" hostspecific="false" #>
<#@ output extension=".sln" #>
<#@ parameter name="Folder" type="System.String" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Xml.Linq" #>
<#
if (Directory.Exists(Folder))
{
var csprojFiles= Directory.GetFiles(Folder, "*.csproj", SearchOption.AllDirectories);
foreach (var file in csprojFiles)
{
ProjectFileMetaData metaData = new ProjectFileMetaData(file, Folder);
WriteLine("Project(\"{3}\") = \"{0}\", \"{1}\", \"{2}\"", metaData.Name, metaData.Path, metaData.Id, ProjectFileMetaData.ProjectTypeGuid);
WriteLine("EndProject");
}
}
#>
<#+
public class ProjectFileMetaData
{
public static string ProjectTypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
public ProjectFileMetaData(string file, string root)
{
InitProperties(file, root);
}
public string Name { get; set; }
public string Path { get; set; }
public string Id { get; set; }
private void InitProperties(string file, string root)
{
XDocument xDoc = XDocument.Load(file);
XNamespace ns = @"http://schemas.microsoft.com/developer/msbuild/2003";
XElement xElement = xDoc.Root.Elements(XName.Get("PropertyGroup", ns.NamespaceName)).First().Element(XName.Get("ProjectGuid", ns.NamespaceName));
if (xElement != null)
{
this.Id = xElement.Value;
}
this.Path = file.Substring(root.Length).TrimStart(new char[] { '\\' });
this.Name = System.IO.Path.GetFileNameWithoutExtension(file);
}
}
#>
@echo off
set _from=*repo
set _to=\\server\repo
FOR /F "tokens=*" %%G IN ('dir /s /b /a:-D /o:-D') DO (CALL :replace %%G) >> files.txt
GOTO :eof
:replace
set _str=%1
call set _result=%%_str:%_from%=%_to%%%
echo %_result%
GOTO :eof