I can't seem to build a project with a custom managed dialog using cscs.exe. The same code works if I run it from a visual studio project. I have reduced it down to a minimal example:
//css_dir ..\..\;
//css_ref System.Core.dll;
//css_ref System.Windows.Forms.dll;
//css_ref Wix_bin\SDK\Microsoft.Deployment.WindowsInstaller.dll;
//css_ref WixSharp.dll;
//css_ref WixSharp.UI.dll;
using WixSharp;
namespace MyProduct
{
public partial class ExitDlg : WixSharp.UI.Forms.ManagedForm, IManagedDialog
{
private void ExitDlg_Load(object sender, System.EventArgs e)
{
Shell.Exit();
}
}
}
class Script
{
static public void Main(string[] args)
{
var project = new ManagedProject("WixTest");
project.ManagedUI = new ManagedUI();
project.ManagedUI.InstallDialogs.Add(WixSharp.Forms.Dialogs.InstallDir)
.Add(WixSharp.Forms.Dialogs.Progress)
.Add<MyProduct.ExitDlg>();
Compiler.BuildMsi(project);
}
}
The error I'm getting is the following:
```Error: Specified file could not be executed.
System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at WixSharp.ManagedAction.<>c.
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.<DistinctIterator>d__641.MoveNext()
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.OrderedEnumerable1.<GetEnumerator>d__1.MoveNext()
at WixSharp.Extensions.GetItemsHashCode[T](IEnumerable1 collection)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.<DistinctIterator>d__641.MoveNext()
at System.Linq.Enumerable.CountTSource
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Linq.Enumerable.FirstOrDefaultTSource
at WixSharp.ProjectValidator.Validate(Project project)
at WixSharp.Compiler.GenerateWixProj(Project project)
at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
at WixSharp.Compiler.BuildWxs(Project project, OutputType type)
at WixSharp.Compiler.Build(Project project, String path, OutputType type)
at WixSharp.Compiler.Build(Project project, OutputType type)
at Script.Main(String[] args) in c:\symphony\wix#test\wixsharptest2\wixsharptest\setup.cs:line 33
```
Great. I can reproduce it. Thank you.
Working on it.
Fixed. The problem was caused by the build script assembly being loaded from memory and not having the assembly location info in the Assembly reflection data System.Reflection.Assembly.Location.
Loading from script assembly memory but not from the file is one of the script execution modes of CS-Script.
The fix will be available in the very next release.
Awesome! :) Impressively fast! I tried the commit tagged above, and it solves both the simplified case posted in the original ticket as well as the full real case where I first encountered it. Many thanks!