Greetings Tobias,

Thank you for your code but it seems we already have <framework> tag support 
for this on WP7/8. Please let me know if it works for you
https://github.com/apache/cordova-plugman/blob/master/src/platforms/wp8.js#L87

<framework src="src\wp8\MyReference.dll" custom="true"/>

<lib-file> has different meaning and is used to add SDKReference
https://github.com/apache/cordova-plugman/blob/master/src/platforms/windows8.js#L87
 
https://github.com/apache/cordova-plugman/blob/master/src/util/w8jsproj.js#L35 

Thx!
Sergey
-----Original Message-----
From: Tobias Jamin [mailto:[email protected]] 
Sent: Thursday, March 20, 2014 3:56 PM
To: [email protected]
Subject: Contribution: <lib-file> support for WP7 and WP8

Hi Cordova devs,

while writing my first cordova plugin for Windows Phone I noticed the missing 
support for <lib-file> for the WP7/WP8 Platforms. The solution is so damn easy 
and I would be glad if you take my solution into the cordova code.
The implementation for <lib-file> for WP is very similar to the implementation 
of <source-file>. The only difference is the invocation of addReference instead 
of addSourceFile (and removeReference instead of removeSourceFile).

FILE:
plugman\src\platforms\wp8.js

OLD CODE:
    "lib-file": {
        install:function(source_el, plugin_dir, project_dir, plugin_id) {
            require('../../plugman').emit('verbose', 'lib-file.install is not 
supported for wp8');
        },
        uninstall:function(source_el, project_dir, plugin_id) {
            require('../../plugman').emit('verbose', 'lib-file.uninstall is not 
supported for wp8');
        }
    }

NEW CODE:
    "lib-file": {
        install:function(lib_el, plugin_dir, project_dir, plugin_id,
project_file) {
            var dest = path.join('Plugins', plugin_id, 
lib_el.attrib['target-dir'] ? lib_el.attrib['target-dir'] : '', 
path.basename(lib_el.attrib['src']));
            var target_path = common.resolveTargetPath(project_dir, dest);
            if (fs.existsSync(target_path)) throw new Error('"' + target_path + 
'" already exists!');
            common.copyFile(plugin_dir, lib_el.attrib['src'], project_dir, 
dest);
            // add reference to this file to csproj.
            project_file.addReference(dest);
        },
        uninstall:function(lib_el, project_dir, plugin_id, project_file) {
            var dest = path.join('Plugins', plugin_id, 
lib_el.attrib['target-dir'] ? lib_el.attrib['target-dir'] : '', 
path.basename(lib_el.attrib['src']));
            common.removeFile(project_dir, dest);
            // remove reference to this file from csproj.
            project_file.removeReference(dest);
        }
    }

The implementation for WP7 is exactly the same as for WP8.

Greetings from Germany,

Tobias Jamin


Reply via email to