@ -0,0 +1,35 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project DefaultTargets="PostBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | |||
<PropertyGroup> | |||
<OPath></OPath> | |||
<SolDir></SolDir> | |||
</PropertyGroup> | |||
<UsingTask TaskName="AssemblyRename" AssemblyFile="$(SolDir)MSBuildTasks\bin\$(Configuration)\MSBuildTasks.dll" /> | |||
<Target Name="PostBuild"> | |||
<Message Text="Relocating" Importance="normal" /> | |||
<ItemGroup> | |||
<SystemFiles Include="$(OPath)I18N.*" /> | |||
<SystemFiles Include="$(OPath)IllusionInjector.*" /> | |||
<SystemFiles Include="$(OPath)IllusionPlugin.*" /> | |||
<SystemFiles Include="$(OPath)RequiredMonoLibs\**\*" /> | |||
<OldLibFiles Include="$(OPath)Libs\**\*" /> | |||
</ItemGroup> | |||
<Move SourceFiles="@(SystemFiles)" DestinationFolder="$(OPath)Data\Managed" /> | |||
<RemoveDir Directories="$(OPath)RequiredMonoLibs" /> | |||
<Delete Files="@(OldLibFiles)" /> | |||
<RemoveDir Directories="$(OPath)Libs" /> | |||
<ItemGroup> | |||
<LibFiles Include="$(OPath)**\*" Exclude="$(OPath)Data\**\*;$(OPath)Lib\**\*" /> | |||
</ItemGroup> | |||
<Move SourceFiles="@(LibFiles)" DestinationFolder="$(OPath)Libs\" /> | |||
<RemoveDir Directories="$(OPath)IncludedLibs" /> | |||
<ItemGroup> | |||
<ToRename Include="$(OPath)Libs\**\*.dll" /> | |||
</ItemGroup> | |||
<AssemblyRename Assemblies="@(ToRename)" /> | |||
</Target> | |||
</Project> |
@ -1 +1 @@ | |||
71a44b54b01a27b264d5e56666d3bd427569aee5 | |||
dae758b90b096a39aa928b136ec952d8ed591e5d |
@ -1 +1 @@ | |||
9c8aaadb0a1830ce0d658b39574b7acf02507f4a | |||
77d5fd2376e4df56c59ee712f4f804807c24fc6f |
@ -0,0 +1,69 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using Mono.Cecil; | |||
using Microsoft.Build.Utilities; | |||
using Microsoft.Build.Framework; | |||
using System.IO; | |||
namespace MSBuildTasks | |||
{ | |||
public class AssemblyRename : Task | |||
{ | |||
private ITaskItem[] assemblies; | |||
[Required] | |||
public ITaskItem[] Assemblies | |||
{ | |||
get => assemblies; | |||
set => assemblies = value; | |||
} | |||
public override bool Execute() | |||
{ | |||
foreach (ITaskItem assembly in Assemblies) | |||
{ | |||
// ItemSpec holds the filename or path of an Item | |||
if (assembly.ItemSpec.Length > 0) | |||
{ | |||
if (!File.Exists(assembly.ItemSpec)) | |||
{ | |||
Log.LogMessage(MessageImportance.Normal, "No file at " + assembly.ItemSpec); | |||
continue; | |||
} | |||
if (Path.GetExtension(assembly.ItemSpec) != ".dll") | |||
{ | |||
Log.LogMessage(MessageImportance.Normal, assembly.ItemSpec + " not a DLL"); | |||
continue; | |||
} | |||
try | |||
{ | |||
Log.LogMessage(MessageImportance.Normal, "Reading " + assembly.ItemSpec); | |||
var module = ModuleDefinition.ReadModule(assembly.ItemSpec); | |||
var asmName = module.Assembly.Name; | |||
var name = asmName.Name; | |||
var version = asmName.Version; | |||
var newFilen = $"{name}.{version}.dll"; | |||
var newFilePath = Path.Combine(Path.GetDirectoryName(assembly.ItemSpec), newFilen); | |||
Log.LogMessage(MessageImportance.Normal, $"Old file: {assembly.ItemSpec}, new file: {newFilePath}"); | |||
if (File.Exists(newFilePath)) | |||
File.Delete(newFilePath); | |||
File.Move(assembly.ItemSpec, newFilePath); | |||
} | |||
catch (Exception e) | |||
{ | |||
Log.LogErrorFromException(e); | |||
} | |||
} | |||
} | |||
return !Log.HasLoggedErrors; | |||
} | |||
} | |||
} |
@ -0,0 +1,84 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
<ProjectGuid>{F08C3C7A-3221-432E-BAB8-32BCE58408C8}</ProjectGuid> | |||
<OutputType>Library</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<RootNamespace>MSBuildTasks</RootNamespace> | |||
<AssemblyName>MSBuildTasks</AssemblyName> | |||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | |||
<FileAlignment>512</FileAlignment> | |||
<TargetFrameworkProfile /> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
<DebugType>full</DebugType> | |||
<Optimize>false</Optimize> | |||
<OutputPath>bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<DebugType>pdbonly</DebugType> | |||
<Optimize>true</Optimize> | |||
<OutputPath>bin\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Microsoft.Build.Framework.15.8.166\lib\net46\Microsoft.Build.Framework.dll</HintPath> | |||
<Private>True</Private> | |||
</Reference> | |||
<Reference Include="Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Microsoft.Build.Utilities.Core.15.8.166\lib\net46\Microsoft.Build.Utilities.Core.dll</HintPath> | |||
<Private>True</Private> | |||
</Reference> | |||
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.16.30\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath> | |||
<EmbedInteropTypes>True</EmbedInteropTypes> | |||
</Reference> | |||
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard1.3\System.Collections.Immutable.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Configuration" /> | |||
<Reference Include="System.Core" /> | |||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> | |||
<Private>True</Private> | |||
</Reference> | |||
<Reference Include="System.Xaml" /> | |||
<Reference Include="System.Xml.Linq" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Net.Http" /> | |||
<Reference Include="System.Xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="AssemblyRenameTask.cs" /> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="packages.config" /> | |||
</ItemGroup> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
</Project> |
@ -0,0 +1,36 @@ | |||
using System.Reflection; | |||
using System.Runtime.CompilerServices; | |||
using System.Runtime.InteropServices; | |||
// General Information about an assembly is controlled through the following | |||
// set of attributes. Change these attribute values to modify the information | |||
// associated with an assembly. | |||
[assembly: AssemblyTitle("MSBuildTasks")] | |||
[assembly: AssemblyDescription("")] | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("")] | |||
[assembly: AssemblyProduct("MSBuildTasks")] | |||
[assembly: AssemblyCopyright("Copyright © 2018")] | |||
[assembly: AssemblyTrademark("")] | |||
[assembly: AssemblyCulture("")] | |||
// Setting ComVisible to false makes the types in this assembly not visible | |||
// to COM components. If you need to access a type in this assembly from | |||
// COM, set the ComVisible attribute to true on that type. | |||
[assembly: ComVisible(false)] | |||
// The following GUID is for the ID of the typelib if this project is exposed to COM | |||
[assembly: Guid("f08c3c7a-3221-432e-bab8-32bce58408c8")] | |||
// Version information for an assembly consists of the following four values: | |||
// | |||
// Major Version | |||
// Minor Version | |||
// Build Number | |||
// Revision | |||
// | |||
// You can specify all the values or you can default the Build and Revision Numbers | |||
// by using the '*' as shown below: | |||
// [assembly: AssemblyVersion("1.0.*")] | |||
[assembly: AssemblyVersion("1.0.0.0")] | |||
[assembly: AssemblyFileVersion("1.0.0.0")] |
@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<packages> | |||
<package id="Microsoft.Build.Framework" version="15.8.166" targetFramework="net46" /> | |||
<package id="Microsoft.Build.Utilities.Core" version="15.8.166" targetFramework="net46" /> | |||
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.16.30" targetFramework="net46" developmentDependency="true" /> | |||
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net46" /> | |||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net46" /> | |||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net46" /> | |||
</packages> |