Skip to content

Commit

Permalink
Added support for client assembly %this% with non '.dll' extension.…
Browse files Browse the repository at this point in the history
… This solves the problem with DTF runtime asm probing failing to locate non standard assemblies (e.g. '.compiled').
  • Loading branch information
oleg-shilo committed Aug 9, 2017
1 parent 94c0d6e commit 3078433
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
Binary file modified Source/src/WixSharp.Samples/WixSharp.Msi.dll
Binary file not shown.
Binary file modified Source/src/WixSharp.Samples/WixSharp.UI.dll
Binary file not shown.
Binary file modified Source/src/WixSharp.Samples/WixSharp.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override void AutoGenerateSources(string outDir)
rawAppAssembly = AppAssembly;
if (rawAppAssembly.EndsWith("%this%"))
{
rawAppAssembly = Compiler.ResolveClientAsm(rawAppAssembly, outDir); //NOTE: if a new file is generated then the Compiler takes care for cleaning any temps
rawAppAssembly = Compiler.ResolveClientAsm(outDir); //NOTE: if a new file is generated then the Compiler takes care for cleaning any temps
if (Payloads.FirstOrDefault(x => x.SourceFile == "%this%") is Payload payload_this)
payload_this.SourceFile = rawAppAssembly;
}
Expand Down
9 changes: 5 additions & 4 deletions Source/src/WixSharp/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ static void Build(Project project, string path, OutputType type)

try
{
//System.Diagnostics.Debug.Assert(false);
// System.Diagnostics.Debug.Assert(false);
Compiler.TempFiles.Clear();
string compiler = Utils.PathCombine(WixLocation, @"candle.exe");
string linker = Utils.PathCombine(WixLocation, @"light.exe");
Expand Down Expand Up @@ -3032,12 +3032,13 @@ static public string ClientAssembly
/// </summary>
static public bool IgnoreClientAssemblyPDB = false;

internal static string ResolveClientAsm(string asmName, string outDir)
internal static string ResolveClientAsm(string outDir)
{
//restore the original assembly name as MakeSfxCA does not like renamed assemblies
string newName = Utils.OriginalAssemblyFile(ClientAssembly);
newName = newName.PathChangeDirectory(outDir);


if (!ClientAssembly.SamePathAs(newName))
{
IO.File.Copy(ClientAssembly, newName, true);
Expand Down Expand Up @@ -3118,7 +3119,7 @@ static void PackageManagedAsm(string asm, string nativeDll, string[] refAssembli
var outDll = IO.Path.GetFullPath(nativeDll);
var asmFile = IO.Path.GetFullPath(asm);

var clientAsmPath = ResolveClientAsm(asmFile, outDir);
var clientAsmPath = ResolveClientAsm(outDir);
if (asmFile.EndsWith("%this%"))
asmFile = clientAsmPath;

Expand All @@ -3141,7 +3142,7 @@ static void PackageManagedAsm(string asm, string nativeDll, string[] refAssembli

if (file == "%this%")
{
refAasmFile = ResolveClientAsm(file, outDir);
refAasmFile = ResolveClientAsm(outDir);
}
else
{
Expand Down
5 changes: 1 addition & 4 deletions Source/src/WixSharp/ProjectValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,8 @@ public string OriginalAssemblyFile(string file)
if (asm == null)
asm = System.Reflection.Assembly.ReflectionOnlyLoadFrom(file);

// for example 'setup.cs.dll' vs 'setup.cs.compiled'
var name = asm.ManifestModule.ScopeName;
if (Path.GetExtension(name) != Path.GetExtension(file))
{
name = Path.GetFileNameWithoutExtension(name) + Path.GetExtension(file);
}

return IO.Path.Combine(dir, name);
}
Expand Down

0 comments on commit 3078433

Please sign in to comment.