Sharing a JSON file between iOS and Android projects - xamarin

I have inherited a Xamarin project (not Xamarin.Forms) and right now it has three major components.
An iOS project, an Android project and finally a Shared Project (not a PCL and not a .Net Standard project).
Despite the Shared Project, the application reads a json file included within the assets folders of each project. The file is a duplicate. I feel like this file should be in the Shared Project
To clarify, this is the structure:
Shared Project
No Assets
iOS
Resources/test.json
Android
Assets/test.json
I believe the test.json file should exist as one file in the Shared Project. My first step was to make this move and I changed the file to Build Action=Content which worked for the iOS project. It seems however the Android project does not get this file. I cannot find it anywhere in the compiled and archived .apk file.
Is there anything I can do about this, or do I need to accept this design flaw and build a .Net Standard library or PCL? If so, how exactly do you make a .Net Standard or PCL for a non-Xamarin.Forms project.

What is your use case? If you just need to read the test.json at runtime and parse it using .NET code, you can use embedded resources, details here: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/files/
If you need the file to go into iOS reosurces / Android assets folder, you can keep the test.json file only once in the solution (either in shared project or as a solution item) and add it as link to both iOS and Android project - here is screen shot how to do it in Visual Studio.
You can do it also in Visual Studio for Mac - right click on the containing folder in solution explorer, choose Add Files and you will get the following prompt - choose Add a link to the file

Related

Visual Studio: Include PlugIn but leave out windows part

I am trying to use not the nuget package but the project itself from the media plugin for xamarin forms.
I am adding all the references and upon build (or even clean) i get :
Error: The specified language targets for uap10.0.16299 is missing. Ensure correct tooling is installed for 'uap'. Missing: '/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets' (Media.Plugin)
I beleive it is looking for the windows SDK which isnt isntalled on my mac and the project itself only supports android and ios.
Using the nuget package, I can check that I only want ios and Android and it works fine, but upon loading the project in as the project it gives me this error.
In the dependencies folder of the project it is still referencing this UAP 10.0.16299 but upon right click all I can do is "refresh".
How can I build my project and leave out this windows crap?
First include the whole project, then edit the CS proj file (right click on solution -> edit project file).
In the first few lines it says: <TargetFramworks...
Remove the unwanted dependencies. They will be gone in the main folder if you save.
Thats it.

Xamarin Form Project: Does Not Have A Dependency Folder

I've just created a new xamarin form project, but couldn't find the folder dependencies folder under my shared project, this folder usually below the Getting Started file.
This lead to I can't add the nuget package for my shared project.
I'm using visual studio 2017 and xCode 10.3
So how can I find this folder on the xamarin-form project?
my project image
There are two types of xamarin forms code sharing strategy: .NET Standard and Shared Project. I guess that your project is of type Shared Project, which makes sense if there were no dependencies folder.
please read the following article:
https://medium.com/#daRochaPires/xamarin-pcl-vs-shared-project-a838806d5cc6

Tesseract for WinRT UWP

I need to use Tesseract on a Windows 10 app for phones. Already found an intent made by Yoisel . I've tried to build the project for test, but i'm kinda new to Visual Studio dependencies and usage.
What i've done so far is to open the tesseract_winrt.sln on the VS2015 folder.
After that i copied leptonica project to root directory of tesseract_winrt so it can be loaded inside the solution. Once that everything is loaded i click build solution and get this errors:
I'm not sure what i'm doing wrong or how to properly set the dependencies
Any idea would be appreciated.
There are now binaries for the project that you can use:
https://github.com/yoisel/tesseract_winrt/releases/tag/v0.1-alpha
It is a set of Visual Studio Extension SDKs, you can install the one for UWP projects on your system and add a reference to it in your project using the "Extensions" tab:
Disclaimer: This project was merely a proof of concept and I strongly recommend not to use it as is in a production scenario

Sharing Files Between a Website and Cordova Project

We are writing a web application (standard MVC for now) and a companion mobile/tablet application using the new visual studio tools for cordova. Many of the assets, images, css, and even the javascript and HTML can be shared between the applications.
I've tried using the "Add As Link" to add an image that "lives" in the MVC app to the images used by the cordova app. However, when the cordova app is built any files that were included using the "Add As Link" option don't appear in the output.
I'd really rather not have to have some build step copy files around as it could quickly turn into a maintenance headache. Is there some configuration I can tweak to make linked files build correctly in cordova projects?
Currently only the files physically present under project directory is picked for deployment and packaging.

Add new project to opencl amd SDK example in Visual Studio 2010

I have build their solution and it works but I want to add a new project and I just can't it says
Cannot open include file: 'CL/cl.h': No such file or directory
What seems to be the problem
Best thing to do is to copy all the settings and project properties from the SDK samples and then execute. Or take a sample project and copy it to your workspace and deleted all the unnecessary files.

Resources