How to properly structure UWP app icons in AppxManifest.xml file for a Win32 app converted using Desktop Bridge (Project Centennial) - winapi

I'm trying to convert my Win32 app into a UWP app using Project Centennial converter (i.e. Desktop bridge.)
After the app is converted, I need to adjust AppxManifest.xml file to ensure the following:
That all icon formats are configured properly.
That I properly specified app resources for: English (US), German, French and Russian languages.
So I followed this Windows 10 icon guide and created the following .png images that were all placed into the Assets folder. I got these:
And my AppxManifest.xml was structured as such:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
<Identity Name="MyApp.Name" ProcessorArchitecture="x86" Publisher="CN=My Name, O=My Name, STREET="Street Address", L=City, S=State, PostalCode=12345, C=US" Version="1.2.3.4" />
<Properties>
<DisplayName>MyApp.Name</DisplayName>
<PublisherDisplayName>PublisherName</PublisherDisplayName>
<Logo>Assets\StoreLogo-50x50.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource Language="de-DE" />
<Resource Language="fr-FR" />
<Resource Language="ru-RU" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14342.0" MaxVersionTested="10.0.14342.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="MyApp.Name" Executable="VFS\Users\ContainerAdministrator\AppData\Local\PublisherName\App Name\RunFile.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="My App Name" Description="My app does this ... and this ..."
BackgroundColor="#aabbcc"
Square71x71Logo="Assets\AppNameSmallTile.png"
Square150x150Logo="Assets\AppNameMedTile.png"
Square310x150Logo="Assets\AppNameWideTile.png"
Square310x310Logo="Assets\AppNameLargeTile.png"
Square44x44Logo="Assets\AppNameAppList.png"
>
<uap:DefaultTile>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
<uap:ShowOn Tile="Square310x150Logo" />
<uap:ShowOn Tile="Square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
<Extensions />
</Application>
</Applications>
</Package>
So can someone answer these questions:
I'm somewhat confused about specifying icons for correct sizes and scaling. Did I do it correctly?
Do I need to specify scaling for Assets\StoreLogo-50x50.png icon as well?
And lastly, did I specify resources for 4 different languages correctly?
EDIT: While waiting, I tried compiling my AppxManifest.xml above with the assets I showed. But makeappx.exe tool gives me the following error:
MakeAppx : error: Error info: error C00CE015: App manifest validation
error: The app manifest must be valid as per schema: Line 22, Column
27, Reason: The attribute 'Square71x71Logo' on the element
'{http://schemas.microsoft.com/appx/manifest/uap/windows10}VisualElements'
is not defined in the DTD/Schema.
It evidently doesn't like the following icon sizes:
Square71x71Logo
Square310x150Logo
Square310x310Logo
But then even if I remove the icon sizes above from AppxManifest.xml, when I try to pack it with the following command:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
I get the following errors about naming assets for scaling:
MakeAppx : error: Manifest validation error: Line 22, Column 27,
Reason: The file name "Assets\AppNameMedTile.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Manifest validation error: Line 23, Column 27, Reason: The file name
"Assets\AppNameAppList.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Package creation failed. MakeAppx : error: 0x80080204 - The specified
package format is not valid: The package manifest is not valid.
Using suggested /l command as such:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /l /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
builds the package with a lot of warnings. But when I install it later, all icons in it seem to be blank.
There must be something that I'm missing here?

I see two main problems: you're defining tile images in the wrong place, and you don't talk at all about a resources.pri file.
The UAP schema is fairly involved, but also reasonably well documented, so make sure you respect its requirements. In particular, the uap:VisualElements element only has the image attributes Square150x150Logo and Square44x44Logo. If you want to define other sizes, they go in attributes on a child uap:DefaultTile element. Note that your uap:ShowOn elements' attributes include an incorrect Square310x150Logo that should instead be wide310x150Logo.
Once you sort that out, makeappx should succeed with your original command line, i.e., without the additional /l parameter. However this is not enough to make your alternate DPI images show up. For that you will need to create a resources.pri file. You can do this manually by using makepri.exe to create a template priconfig.xml, update it, then invoke makepri again to build the resources.pri from it.
Alternately, use a tool that will create an app package with a resources.pri for you (such as Visual Studio), and extract the resources.pri and add it to your package. Just make sure the locations you use in your package match the ones in the package created by the tool, as relative paths are stored in the resources.pri file. (As a bonus, you can look at the AppxManifest.xml that this creates to verify that your structure from the first part is correct. Just don't forget that apps using the desktop bridge will have additional namespaces and capabilities that Visual Studio won't offer.)

Related

Load language file during joomla (2.5) system plugin installation

I'm having a real hard time showing a localized string during the installation of a system plugin (in Joomla 2.5). The "normal" way with localized strings in the xml file doesn't seem to work, (see this other question: Language based installation description).
I now tried the way proposed there, to show the description via the install scripts. This kind of works (I can echo text successfully), however, I also can't localize there - when debugging the language it shows that the plugin.sys.ini is not loaded yet; I tried to manually load the file, but had no success with loading any of my plugin language files.
This is what I got so far (in a file named setupscripts.php):
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
class plgsystemmyplgnameInstallerScript {
static function loadLanguage() {
$lang =& JFactory::getLanguage();
$lang->load('plg_system_myname', JPATH_ADMINISTRATOR);
}
function install($parent)
{
self::loadLanguage();
echo JTEXT::_("PLG_MYNAME_TEST_TEXT");
}
function uninstall($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UNINSTALL_TEXT');
}
function update($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UPDATE_TEXT');
}
function preflight($type, $parent) {}
function postflight($type, $parent) {
self::loadLanguage();
echo JText::_('PLG_MYNAME_INSTALL_TEXT');
}
}
But I only get ??PLG_MYNAME_TEST_TEXT?? ??PLG_MYNAME_INSTALL_TEXT?? (language debugging is turned on) during installation... weirdly enough, the language debug feature at the bottom of the page under "untranslated strings" shows "None" (where do the question marks then come from if not from a tried but failed translation???).
Tried some variations of it (with .sys at the end of the plugin name, since I actually think the setup strings should be in the .sys.ini file, without the second parameter (leaving it default), but no luck - no error, nothing in the log (in fact my log file isn't existing, probably there was no entry yet? can one set the log level with Joomla?). But never is there any file loaded (nothing changes under "loaded language files".
Anybody got an idea how to load the language properly?
Is there something special to consider when loading languages during setup? Why is there no error message if loading the languages fails? Do I maybe have to install the language files to a special location to get them recognized during installation? My current xml looks like this:
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_MYNAME</name>
<!-- ... author, copyright, version, .. -->
<scriptfile>setupscripts.php</scriptfile>
<files>
<filename plugin="myname">myname.php</filename>
<filename>setupscripts.php</filename>
<filename>index.html</filename>
<folder>sql</folder>
</files>
<!-- ... install->sql->file ... -->
<!-- ... uninstall->sql->file ... -->
<!-- ... update->schemas->schemapath ... -->
<languages [folder="admin"]>
<language tag="en-GB">en-GB.plg_system_myname.ini</language>
<language tag="en-GB">en-GB.plg_system_myname.sys.ini</language>
<!-- ... other languages ... -->
</languages>
<!-- ... config->fields->fieldset->field ... -->
</extension>
(the square brackes around folder="admin" are supposed to indicate that I tried both with and without this attribute. It doesn't change anything).
It only works on installation if you also copy the files to the admin language folder. If you look at the core extensions you will see that they do both. It's really a bug but that's the work around.
Finally I found out how to really do it. A thorough search in the google Joomla dev group brought up this very similar question.
Basically, the language files need to reside in a separate language folder it seems, and the files section also needs to reference them. My xml now looks like this:
<!-- ... everything else stayed the same, except: -->
<files>
<filename plugin="myplg">myplg.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>sql</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.sys.ini</language>
<!-- .. other languages ... ->
</languages>
<!-- ... rest of the xml file ... -->
The language files are now all in separate subfolders... they get copied to the exact same location as before (administrator/language//...), but now the description from the XML is also localized!
I find it very weird that there are so many ways to specify language files, which all basically work except for the one corner case of the installation...
Hope this will help other people struggling with this!

XNA projects hosted in Dropbox fails to build due to incorrect file paths

I have an XNA project that's hosted and shared with another user via a Dropbox account. When I try to build, it fails with this error:
Unable to copy file "D:\Documents\Dropbox\Super Mario Limitless\SuperMarioLimitless\SuperMarioLimitless\bin\x86\Debug\Content\m_norm.xnb" to "bin\x86\Debug\m_norm.xnb". Could not find a part of the path 'D:\Documents\Dropbox\Super Mario Limitless\SuperMarioLimitless\SuperMarioLimitless\bin\x86\Debug\Content\m_norm.xnb'.
It seems to be trying to pull a file out of the other computer's path, which clearly doesn't exist on this computer. I've traced it down (roughly) to a file called ContentPipeline.xml in $(SolutionFolder)\SuperMarioLimitlessContent\obj\x86\Debug\
<Item>
<Source>m_norm.png</Source>
<Name>m_norm</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
<Options>None</Options>
<Output>D:\Documents\Dropbox\Super Mario Limitless\SuperMarioLimitless\SuperMarioLimitless\bin\x86\Debug\Content\m_norm.xnb</Output>
<Time>2012-12-06T21:47:30-05:00</Time>
</Item>
Now, I can change the paths to my own, and it will work for me but not for him. I tried changing them to relative paths, but it doesn't seem like whatever's loading this file will parse relative paths, nor does it work with $(SolutionFolder) or $(ProjectFolder), instead interpreting them literally.
The two content files in question are both set to "Build Action: Compile" and "Copy to Output Directory: Copy Always".
So, is there a way to fix this, or is this a sign of deeper problems?
Thanks in advance.

Is it possible to pass variable to WIX localization file?

I need to use variable in WIX localization file WIXUI_en-us.wxl.
I tried use it like this:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product $(var.InstallationVersionForGUI) is already installed</String>
But it doesn't work. And when I declared property and used it this way:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product [InstallationVersionForGUI] is already installed</String>
doesn't work either.
Where was I wrong?
Thanks for help and your time.
Localization strings are processed at link time, so you can't use $(var) preprocessor variables. Using a [property] reference is supported, as long as the place where the localization string is used supports run-time formatting (e.g., using the Formatted field type).
Your second method should work just fine. This is the same method used by the default .wxl files.
For example, in your .wxl file you would declare your string:
<String Id="Message_Foo">Foo blah blah [Property1]</String>
And in your .wxs file, you declare the property. If you wish, you can declare the property to match a WiX variable (which it sounds like you're trying to do)
<Property Id="Property1">$(var.Property1)</Property>
I was trying to get localization file to use variables. Came across this post:
There are different layers of variables in WiX (candle's preprocessor
variables, Light's WixVariables/localization variables/binder
variables, and MSI's properties). Each have different syntax and are
evaluated at different times:
Candle's preprocessor variables "$(var.VariableName)" are evaluated
when candle runs, and can be set from candle's commandline and from
"" statements. Buildtime environment
properties as well as custom variables can also be accessed similarly
(changing the "var." prefix with other values).
Light's variables accessible from the command-line are the
WixVariables, and accessing them is via the "!(wix.VariableName)"
syntax. To access your variable from your commandline, you would need
to change your String to: This build was prepared on
!(wix.BuildMachine)
If you instead need to have the BuildMachine value exist as an MSI
property at installation time (which is the "[VariableName]" syntax)
you would need to add the following to one of your wxs files in a
fragment that is already linked in:
Now, the environment variable COMPUTERNAME always has held the name of
my build machines in the past, and you can access that this way:
$(env.COMPUTERNAME). So, you can get rid of the commandline addition
to light.exe and change your wxs file like this:
<WixProperty Id="BuildMachine" Value="$(env.COMPUTERNAME)"/>
Preprocessor variables $(var.VariableName) are are processed at link time, so ideally you would use [PropertyName] which would be defined on the main Product element.
The issue sometimes is that property is not yet defined, for instance using the product name on the localization file seems not posible.
This solution was done aiming to only type the product name once given "Super product" as product name:
In case of running through visual studio extension:
Project properties -> Build -> Define variables -> "MyProductName=Super product" (No quotes)
In case of runing from cmd or some other place:
On Light.exe, add -d"MyProductName=Super product"
Into the localization .wxl file:
<String Id="Description" Overridable="yes">Description of !(wix.MyProductName)
to make it more interesting</String>
I have an aditional config file .wxi I include on other files to have some vars, for instance, here i had hardcoded the value but now it's harcoded on the variable definition and I use the given value:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<!-- Define the product name preprocesor variable -->
<?define ProductName="!(wix.ProductNameDefVar)" ?>
<!-- From this point, can use the preprocesor var -->
<?define ProductName_x64="$(var.ProductName) (64bit)" ?>
<?define ProductName_x32="$(var.ProductName) (32bit)" ?>
<?define CompanyDirName = "My company name" ?>
</Include>
Finally, the place where the localization value where the localization text was not interpolating, is like this:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Include the config file with the preprocesor var -->
<?include $(sys.CURRENTDIR)\Config.wxi?>
<!-- Main product definition -->
<Product Id="$(var.ProductCode)"
Name="$(var.ProductName)"
Language="!(loc.Language)"
Version="$(var.BuildVersion)"
Manufacturer="!(loc.Company)"
UpgradeCode="$(var.UpgradeCode)">
<!-- Package details -->
<!-- Here, Description was not interpolating -->
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Platform="$(var.Platform)"
Manufacturer="!(loc.Company)"
Description="!(loc.Description)"
Keywords="!(loc.Keywords)"
Comments="!(loc.Comments)"
Languages="!(loc.Language)"
/>
[...]

Applescript not accepting arRsync sdef commands?

I'm using the opensource GUI frontend for rsync called "arRsync". It works great, but there's no way to automate it.
What I'm trying to do is use Applescript to run a preset (which you define in the Application) using the following simple script:
tell application "arRsync" to runPreset "presetTest1"
The problem is Applescript thinks "runPreset" is a variable, not a command. I've also tried a tell/end-tell variation of the above, no dice. The 'runPreset' command is part of arRsync.sdef
You can find the arRsync project here
I've tried opening up both Info.plist files inside the app and ticking the 'Scriptable' box (or setting it to 'true' for those of you without Property List Editor) but I'm still stuck.
I'm a scripting noob when it comes to Cocoa :p help would be greatly appreciated
The arRsync binary is missing a scripting dictionary. Build from source, first making the following changes:
Edit Info.plist in the project, setting the "Scriptable" option to true.
Fix the project's script dictionary, arRsync.sdef. The code for the runPreset command has one letter too few (command codes must be two FourCCs, or eight characters, long). Add a character to runPreset's code attribute; just about any character will work. If you want, the file can be shortened and simplified by replacing the Standard and Text suites with an include. Back up the orignal file and make a new arRsync.sdef containing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="arRsync Terminology"
xmlns:xi="http://www.w3.org/2003/XInclude">
<xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef"
xpointer="xpointer(/dictionary/suite)"/>
<suite name="arRsync Suite" code="arRs">
<command name="runPreset" code="runPPrst">
<cocoa name="runPreset" class="scriptController"/>
<direct-parameter type="any"/>
</command>
</suite>
</dictionary>
Alternatively, you could just replace the runPreset command element with the one from above.
Add arRsync.sdef to the "Copy Bundle Resources" phase of the arRsync target
Switch to a Release build ("Blackbeard" is the name for the debug build).
Build it.
That should produce a scriptable version of arRsync. As you've already figured out, you also might need to play with the target SDK.

Install a pfx certificate in a users store in Windows using WiX

Please, can someone provide me with a WiX snippet or solution for the mentioned scenario. I need to include the pfx file in the WiX msi and the user will download my msi to his machine via the internet explorer and Click install and I need also the certificate to be installed on his machine.
You need the Certificate element. It is part of the IIS extension for wix, but can be used for non-IIS related installations also.
You need to
declare a prefix for the iis namespace, for
example like this in the root Wix element:
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
Embed the PFX file as a binary
stream in your install package. Add
a Binary element under the
product element like this:
<Binary Id="MyCertificateBinaryStream"
SourceFile="c:/path/to/mycertificate.pfx" />
Declare a component with a <iis:Certificate> element, for
example like this. Look at the
documentation, you need to fill in some
more attributes. Note that you don't need CertficatePath if you use the BinaryKey attribute.
<Component Id="MyCertificateComponent" Guid="MY-GUID-HERE">
<iis:Certificate Id="MyCertificate"
BinaryKey="MyCertificateBinaryStream"
... some more attributes ...
/>
</Component>
Activate the IIS extension by adding
the option -ext WixIISExtension
option when invoking the wix command line tools. If you use visual studio, this is just a matter of adding a reference in your wix project to WixIISExtension.
To expand on the answer a little, the following set of attributes worked for me:
<iis:Certificate
Id="My.Certificate"
StoreName="root"
Overwrite="yes"
Name="My Friendly Certificate Name"
Request="no"
BinaryKey="MyCertificate.Binary"
StoreLocation="localMachine" />
Where the <Product> element contained a <Binary> child as follows:
<Binary
Id="MyCertificate.Binary"
SourceFile="$(var.ProjectDir)MyCertificate.pfx" />
(I included the PFX file within my WiX project).

Resources