Copy GitTfs.Vs20xx in subfolders

and load assemblies from there...
This commit is contained in:
Philippe Miossec
2015-08-15 23:57:10 +02:00
parent afdd66ede6
commit 90aeee42e4
6 changed files with 24 additions and 5 deletions
+2 -1
View File
@@ -144,7 +144,8 @@
</Target>
-->
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"
xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
+2 -1
View File
@@ -94,7 +94,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"
xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+2 -1
View File
@@ -96,7 +96,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"
xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+2 -1
View File
@@ -282,7 +282,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)"</PostBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"
xcopy /y "$(TargetDir)*.dll" "$(SolutionDir)GitTfs\$(OutDir)\$(ProjectName)"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="..\packages\Microsoft.TeamFoundationServer.ExtendedClient.14.83.1\build\Microsoft.TeamFoundationServer.ExtendedClient.targets" Condition="Exists('..\packages\Microsoft.TeamFoundationServer.ExtendedClient.14.83.1\build\Microsoft.TeamFoundationServer.ExtendedClient.targets')" />
+15
View File
@@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection;
using StructureMap;
using StructureMap.Graph;
using System.IO;
namespace Sep.Git.Tfs.Core.TfsInterop
{
@@ -29,9 +30,13 @@ namespace Sep.Git.Tfs.Core.TfsInterop
class PluginLoader
{
private List<Exception> _failures = new List<Exception>();
private static string VsPluginAssemblyFolder { get; set; }
public TfsPlugin Try(string assembly, string pluginType)
{
VsPluginAssemblyFolder = assembly;
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += LoadFromSameFolder;
try
{
var plugin = (TfsPlugin)Activator.CreateInstance(Assembly.Load(assembly).GetType(pluginType));
@@ -44,9 +49,19 @@ namespace Sep.Git.Tfs.Core.TfsInterop
{
_failures.Add(e);
}
currentDomain.AssemblyResolve -= LoadFromSameFolder;
return null;
}
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
{
string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyPath = Path.Combine(folderPath, VsPluginAssemblyFolder, new AssemblyName(args.Name).Name + ".dll");
if (File.Exists(assemblyPath) == false) return null;
Assembly assembly = Assembly.LoadFrom(assemblyPath);
return assembly;
}
public TfsPlugin Fail()
{
throw new PluginLoaderException(_failures);
+1 -1
View File
@@ -19,7 +19,7 @@ after_build:
$libgit2Binaries=Get-ChildItem ".\packages\" -Filter "NativeBinaries" -Recurse | Select-Object -First 1 | % { $_.FullName }
Copy-Item $libgit2Binaries "$Env:APPVEYOR_BUILD_FOLDER\GitTfs\bin\$env:Config" -Recurse
}
Get-ChildItem .\packages -Recurse -Filter Microsoft.WITDataStore*.dll | Copy-Item -Destination "$Env:APPVEYOR_BUILD_FOLDER\GitTfs\bin\Debug\"
Get-ChildItem .\packages -Recurse -Filter Microsoft.WITDataStore*.dll | Copy-Item -Destination "$Env:APPVEYOR_BUILD_FOLDER\GitTfs\bin\$env:Config\GitTfs.Vs2015\"
$zipFile= "git-tfs_$Env:APPVEYOR_REPO_COMMIT.zip"
7z a $zipFile "$Env:APPVEYOR_BUILD_FOLDER\GitTfs\bin\$env:Config\*" -xr!"*.pdb"
test: