다음을 통해 공유


Adding SDK Extension to the project from a specific folder


Scope

This article has the goal to expose a sample for add a SDK Extension to a project from a specific folder.

Motivation

Sometimes developers need:

  • to manage the SDK Extension in their apps, and in some cases they need to keep different versions for the same SDK Extension for different version of the same app;

  • to specify the SDK Extension folder for build process in  continuous integration; 

  • to share samples in community and for help the users, is added the Sdks Extension to the project, this way the user don´t need to install it;

Real case,  the team of Xamarin.Forms.Labs project, created a sample for Windows Phone 8.0. This sample uses the database SQLite, and for help users to run the sample, was associated to the project the SQLite SDK Extension. With this, the user don´t need to install the SQLite SDK Extension in PC, is only build and run the sample.

The solution

When we install the SQLite SDK Extension the installation don´t says where the SDK Extension is installed, but is easy to get the path. For it open/create a Windows Phone project and then Add reference >Windows Phone SDK 8.0 and with the mouse over the title of the sdk extension is possible to see the complete path.

http://s9.postimg.org/qjfqnrgwv/sqlite.png

Then go to that path, and you see something like it

http://s28.postimg.org/mnowywlx9/sqlite1.png

In the project you should create a folder for the SDK Extensions and inside add a folder with the same tree as we see before:

Windows Phone\v8.0\ExtensionsSDKs\SQLite.WP80

For help, we can see the result in Xamarin.Forms.Labs project:

http://s16.postimg.org/swsj0dvo5/folder.png

Note: The folder Sdks was created in the same root as the solution. And if you get the repository you will see that there is a folder for samples and another for source code, and the solution and sdks folder are inside the scr folder.

After the Sdks folder is created we need to add a configuration to the Windows Phone Project (the project that uses this SDK Extension). In the cproj file add:

<PropertyGroup>
  <SDKReferenceDirectoryRoot>$(SolutionDir)\Sdks;$(SDKReferenceDirectoryRoot)</SDKReferenceDirectoryRoot>
</PropertyGroup>

In Xamarin.Forms.Labs you can find this in Xamarin.Forms.Labs.Sample.WP.csproj file.

With the solution opened, select the project > add reference >Windows Phone SDK 8.0 and with mouse you can see the path for the SDK Extension

http://s30.postimg.org/djc45dthd/sqlite.png

Conclusion

In conclusion, adding a especific SDK Extension folder to a project, without installing SDK Extension in PC, is very simple and can help to manage the different version of the SDK Extension and can be useful for build servers with continuous integration.

http://c.statcounter.com/10000087/0/b7a0708e/1/