Automate compilation process for Windows Phone application and multiple variations - batch-file

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.

Related

Xaml files inside a shared project appearing differently in VS2017

I have a solution, containing a shared project:
This contains a number of Xaml files:
However, when I open the exact same solution in VS2017, I get this:
The problem seems to cause any XAML files to be invisible within the project. The solution compiles and runs fine - is there something that needs to be installed or switched for VS2017 to treat shared projects correctly?
First Solution
(1) Exclude
(2) Show All Files
(3) Include all the files
Found some similar post may be work for you (seems to be some sdk needs to be installed)
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/26291339-e8fd-4596-980a-7befa63a1f7c/missing-folders-files-add-item-options-in-shared-project?forum=visualstudiogeneral
Thanks
Using the Visual Studio 2017 Installer, add support for Universal Windows Platform Development. That will connect each xaml to its respective xaml.cs in a shared project.
One would think that .Net Desktop Development would be enough to do the link, but it is not.

How to compile source of Core and Service on WinRT?

We are trying to make the control panel service working on WinRT. However, we could not compile the code because we cannot find the namespace 'ajn'.
What we have done is:
Download the core source and the service source from AllJoyn website.
Setup a C++ uwp runtime component project and include all those source.
Add C++ wrapper codes to use the control panel service.
Setup another uwp blank app project, so it could use the wrapper codes to utilize contorl panel service.
However, we got stuck on compiling the codes, because the compiler could not find the all those classes under namespace ajn.
Where could we find the namespace? Or did we use the wrong source?
Thank you!
EDIT:
We managed to find those file, However, some linking errors shown up. Is there any good document which shows making codes process for WinRT? Or is WinRT Code Generation is well configured at all? Thanks!
Actually, the files are all in alljoyn_core folder, now the codes have been compiled.
However, some linking errors shown up. Is there any good document which shows making codes process for WinRT? Or is WinRT Code Generation is well configured at all? Thanks!
Just follow the Documentation on the Allseen Alliance's website. here is the link for the building Windows
Building on Windows
Just make sure to follow the steps after creating a new project in Visual Studio
Make sure you set the envionment variables correctly and avoid spelling mistakes. The spelling mistake cost me two to three days in finding the linking error.!

Deploy WinForm application generating single exe file

I need to deploy a WinForm application and I need to generate just 1 .exe file.
I tried with ClickOnce but it generates also a manifest file, so I can't use it,
and I can not use the Release folder content because there aerseveral files (eg. strings resources)
Thanks a lot!
There's a little tool called ILMerge.
With this it is possible to merge several dlls and exe into one exe.
I don't know if it is possible to integrate resource files as well, but i don't think so.
Have a look at:
ILMerge Best Practices

How to deploy WPF application with WIX

I have started to use WIX to deploy a WPF application. I have created the .wxs file with the desired interface features etc...
My questions is how to distribute the required .Net files that support my WPF executable? Not the .net framework or sql server express, but the dependencies needed to run my executable.
Should the process include building a msi with VS Installer, then including that msi into my WIX script and running that inside of my WIX msi?
Or, what is the correct process for distributing a WPF executable with WIX?
I don't think your question pertains to WiX or WPF at all. What you need to ensure is that you package up the necessary dependencies along with your installer, whatever they may be. Referencing your dependency files in your installer script should be sufficient.
Here's the process that I follow for any application.
1) Start with a clean VM that represents the least common denominator of a machine I want to target. Let's say WinXP SP2 32bit.
2) Deploy my application by hand and record all of the steps in a word document. Then try those steps on other OS's to make sure you didn't miss anything.
3) Take each of the steps in my document and implement them in WxS. Keep in mind that Windows Installer and Windows Installer XML is a declarative programming language not an imperative programming language. You don't tell it to xcopy files from dir a to dir b, you describe the directory structure and the installer takes care of it.
BTW, of the things you mentioned, your asking for help with what I consider the simple stuff and excluding the harder more complicated stuff.
As an alternative way, you might see also this post Embedding dlls in a compiled executable to embed all the dll needed (like the interop ones for example) using Costura.Fody. Using WIX there is no more need to add any dependent dll as components in the .wsx file.

WPF - Copying resources on publishing

I'm developing an WPF application that has an reference of a C# Class Library.
That C# Class Library has a few XML files that i'm copying to output as embed resources.
When i debug the WPF application, those XML are copied to debug folder of WPF and the app runs properly.
But when i publish the application i get errors because the application isn't finding the resources.
I must admit i'm just now introducing to WPF, so i haven't understand yet the process of publishing and installing the application.
Those XML files should be published by VS in "Aplication Files" folder of the published folder? If yes, what i'm i doing wrong?
By the way, i'm accessing those files in my code (of C# Class Library) from AppDomain.CurrentDomain.BaseDirectory
Thanks
Are you using click once for publishing? you can define what dependencies you need and for each one where place must have.

Resources