Select an entry point with MageUI in the command line - wpf

This is related to this article but is not a duplicate.
I have a WPF app deployed via ClickOnce, and one of the projects in the solution is simple UI-less standalone Winforms app. This exe should live in the same directory of the main wpf exe. What happens after deploying is that this app runs instead of the wpf app. When I looked at the manifest, the entry point was set to the winforms app instead of the wpf app. I am not sure if its alphabetically related (the name of the winforms app is listed before the wpf one in the filesystem after deployment), but what I want to do is change the entry point in the manifest programmatically (via commandline arguments).
MageUI lets you define the entry point, just like RobinDotNet reveals, but is there a commandline switch to do this via mage.exe?

No. That's what I found frustrating with the command line version of Mage. Usually you can do more with the command line version of an app, not less. But there are several things MageUI can do that the command line version can't.
Here's what MSDN says about it...
Mage.exe will also use a simple set of heuristics to detect the main
executable for the application, and will mark it as the ClickOnce
application's entry point in the manifest.
I don't know what those heuristics are, but I would start by playing with the names of the exes. If all else fails, you can...
Generate the manifest with mage.
Modify the entry point in the manifest with your own code.
Re-sign the manifest with mage.

Related

Integrating a custom launcher into the Visual Studio Debugger

We're creating a Visual Studio Debugger extension that needs to launch the application being debugged through a custom launcher that sets up the runtime (not the CLR or Win32) and launch the target application in a new process. In other words, the custom launcher is in charge of creating the new process. In the VS Debugger, one typically launches the debugger by calling VsShellUtilities.LaunchDebugger() and supplying a VsDebugTargetInfo object whose dlo field is set to DEBUG_LAUNCH_OPERATION.DLO_CreateProcess, along with the coordinates of the exe file to be launched and debugged. This doesn't conform to our launching model.
There is also a dlo value DEBUG_LAUNCH_OPERATION.DLO_Custom that seems to be for this purpose (using the clsIdCustom field to indicate the launcher), but the current documentation says that's obsolete and directs us back to DEBUG_LAUNCH_OPERATION.DLO_CreateProcess, but not only doesn't that fit our model, but clsidCustom is used in this case to indicate the debug engine (if it's just a single one).
So, what is the recommended way for us to launch the VS debugger and use our custom launcher to configure and start our runtime (and the application within it)?
According to the Visual Studio API document, it only provide the DLO_CreateProcess to Launches the process. You could use dwClsidCount and pclsidList specify the debug engines to use.
Following example introduce how to call a custom launcher through a VSIX project.
https://code.msdn.microsoft.com/Visual-Studio-Debug-Engine-c2e21c0e
I'm having difficulty porting to a Modern VS2022 but I've been using the VSIX template built of of this Extension which works for VS2017 and VS2019. after some tinkering. This does work for VS2022 but only if you don't tamper with the packages.
https://github.com/microsoft/VSProjectSystem/blob/master/doc/extensibility/IDebugLaunchProvider.md Good luck there's not a lot out there so I thought I'd offer you this gem.
This allows you to make a drop done selection for a project property sheets for debugging. you got to import the targets file which then imports the rules sheet that you create which means you got to make a wizard that creates a custom project.

Automate compilation process for Windows Phone application and multiple variations

I am developing multiple Windows Phone applications that vary only by the content of several files. Applications share the same logic therefore I created a project and multiple folders, one for each app variation with variant's assets and files and moved them to separate location. To compile project I copy over files and follow a standard compilation process with Visual Studio.
Now there are only 5 application variations and for now it is suiting solution, but the number is expected to grow to 50 and more. I would like to automate the process and my current idea is to write a batch script to copy files from variation folder, overwrite project files, compile app with a script and to copy xap package to another location.
My two questions are:
Is my idea good resolution of the problem or is there a more graceful way to do this I am not aware of? (manage and develop multiple app variations)
How would I compile windows phone app from cmd?
I think your problem is valid. I ran into a similar requirement in the past (only that it was for Windows 8 Store Apps), and what I did was the following:
Create a "core" project and moved all the shared logic to that project. I then created a sample app project, referenced the core project and made sure the sample app worked the way I wanted it to.
Finally, I converted the sample app into a Visual Studio template. What this basically does is take the project code and create a Visual Studio template you can reuse.
Read more about it here.
Some work needed to be done within the template source code in order to get some of the dynamic parts like app name into specific locations within the code. For example, you can change a class namespace to be the project's namespace by applying the following code in tour class:
namespace $safeprojectname$
You can read more about template parameters here.
Hope it helps.
To compile windows phone applications or any .NET app from command line you should use
msbuild.exe
. You can find more information and samples here.

WPF application execution path

I have developed a WPF application and placed the executables on a network path. I have distributed the shortcut to the application to the users. Now, users can launch the WPF application by running the shortcut.
In the WPF application, I like to know from what client's drive the application was executed. In other words, I like to know the letter of the drive where the shortcut was placed. Is it possible to get this information? If yes, how?
BTW, I am aware of "Assembly.GetExecutingAssembly().Location" but this returns the path to application, not the path to shortcut.
Thanks,
To the best of my knowledge there is no way to find this out. What you could do, though, is add a command-line parameter to the shortcut stating the drive.

Localization of a WPF ClickOnce application with LocBaml

I'm trying to use the LocBaml way (this might be my mistake) to localize a WPF application, but this application is deployed with ClickOnce and the publishing process doesn't pick up the localized .resource.dll.
I do add the files to my ClickOnce manifest, and I can see that this part works because when I launch the application, I get an error saying that the application can't find fr\LocalizationTest.resource.dll. (So at least it knows it should be there...)
The normal way to include a file in a ClickOnce application is simply to add it in the Project Properties -> Publish -> Application Files menu, but my localized resources are not in there.
What can I do ?
Turns out adding a dummy Resources.fr.resx in the Properties folder fixed the problem. With that the publishing process picked up the translated .dll and the ClickOnce application worked as expected.

Prism third party control assembly in module

I have a prism app where I've added a third party WPF control library to one of my modules.
I get an exception that the dll cannot be found when I run my application. Using fusion log viewer I see that the assembly is being looked for in the shell prject bin rather than in the module.
If I were to add a reference to the shell as well then that would get it working but clearly would break the point of a modular design.
Anyone else have experience of how to get this working?
To handle this kind of deployment problem, I usually execute an xcopy command on Visual Studio project post-build events, to copy all modules dependencies and even modules themselves ( when there are no direct references between projects, and that should not be the case normally) into the running folder (the shell bin folder).
Riana

Resources