![]() When the Shared Project is referenced by two-or-more other projects, a menu appears in the top-left of the source code editor that shows which projects reference this file. Once the Shared Project is referenced by another library or application you can build the solution and view any errors in the code. This screenshot shows a Xamarin.iOS project referencing a Shared Project. A Shared Project does not get compiled when it has nothing referencing it, so syntax (or any other) errors will not be highlighted until it has been referenced by something else.Īdding a reference to a Shared Project is done the same way as referencing a regular Library project. ![]() On the next screen, choose the project name and click Create.Ī new Shared Project is shown below - notice there are no References or Component nodes these are not supported for Shared Projects.įor a Shared Project to be useful, it needs to be referenced by at least one build-able project (such as an iOS or Android application or library, or a PCL project). ![]() (or right click an existing solution and choosing Add > Add New Project.): To create a new Shared Project navigate to File > New Solution. Refer the to Shared Project Example section for a complete example. This section walks through how to create and use a Shared Project using Visual Studio for Mac. For more information about Shared Project. Note that Android application projects cannot reference other Android application projects - for example, an Android unit test project cannot reference an Android application project. Shared Projects cannot reference any other project type (including other Shared Projects). When referenced by another project, the code is effectively compiled as part of that project. ![]() The code in a Shared Project can contain compiler directives that will enable or disable sections of code depending on which application project is using the code, which is suggested by the colored platform boxes in the diagram.Ī Shared Project does not get compiled on its own, it exists purely as a grouping of source code files that can be included in other projects. This is illustrated in the diagram below - conceptually the entire contents of the Shared Project is "copied into" each referencing project and compiled as though it was a part of them. Unlike most other project types a shared project does not have any output (in DLL form), instead the code is compiled into each project that references it. If you have used file-linking in the past to share code between projects, Shared Projects works in a similar way but with much improved IDE support. There is also IDE support to help manage the compiler directives and visualize how the code will look in each application. They support compiler directives so that you can conditionally include platform-specific code to be compiled into a subset of the projects that are referencing the Shared Project. Shared Projects (also sometimes called Shared Asset Projects) let you write code that is shared between multiple target projects including Xamarin applications. ![]() The code is compiled as part of each referencing project and can include compiler directives to help incorporate platform-specific functionality into the shared code base. Shared Projects let you write common code that is referenced by a number of different application projects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |