How do you add manifest files to UWP projects that Unity3D builds? - c#

I am porting a game to Windows 10 and Xbox One, which requires that I have certain manifest files in my UWP app for defining the capabilities and socket usage of the application.
I understand the uses of these manifest files; however, I do not understand how I am able to configure the manifests that are built or injected into UWP applications that Unity3D creates when building.
Specifically, I need to add the file networkmanifest.xml to my UWP app to define socket usage for use with Xbox Live. Here is a link to Microsoft's documentation on the manifest file.
Research into this area has left me drawing a blank, and I'm not sure if it is because I'm fundamentally looking at this problem wrong.

There are two good options here:
Write a script that automatically gets run after the build (using OnPostprocessBuild) and copy/inject your manifest into the generated project there.
Modify the generated Visual Studio solution and commit the files you modified to your project source control. When building your game from Unity, always build on top of the same modified project. Unity will not overwrite the changes you made.

Related

Create A DLL to work on a solution targeting Master ARM64? (Hololens 2)

I develop applications targeting the Hololens 2 platform (mixed reality).
The general idea of the application I am trying to build is using a point cloud registration algorithm, which targets a previously scanned model on one hand and the visible point cloud generated by the Hololens' SceneUnderstanding ability on the other.
My main problem is that all the different implementations that I found of the algorithm are using libraries (DLLs) that:
Uses a lower-level language (C++) than the C# scripting language used in Unity's scripts.
Are not targeting the needed configuration and architecture needed for deploying an application on the Hololens 2 (Master configuration, ARM64 architecture).
In the process of trying to generate that kind of library myself (using visual studio 2019 to build "Dynamic-Link Library with Exports [DLL]"),
I created the simplest library in C++ - A single function that returns an integer (without the dependency of any other library). Obviously, when targeting the Unity Editor application it was easy to use the library's function from the C# script attached to the Unity project, but when I try to convert the solution's configuration and architecture to Master ARM64, building a Visual Studio solution and deploying the application on the Hololens 2 generates a script error: "Unable to load DLL '<dll_name>': The specified module could not be found."
I can think of two major reasons that will cause this problem:
The program can not find the library needed for function execution,
JUST BECAUSE the location of the library is not correct (I have NO IDEA
where the library should be placed in the solution hierarchy).
I am probably not using the right technique for converting the library to the correct target solution properties (in addition of the previous scenario)
(and as well, I have no idea what is the correct procedure for achieving correct targeting properties)
Using: Visual Studio 2019, Unity 2019.4.1f1, Hololens 2nd generation
It would mean a lot to hear from anyone who have encountered any sort of similar problem, thank you in advance!
To add a custom DLL to a Unity project for HoloLens 2, you have to copy the DLL to a folder called Assets/Plugins/WSAPlayer/ARM64 in your project hierarchy in Unity. Then, you should also make sure that the correct Platform settings are specified for the Plugin in the Inspector, i.e., SDK should be set to UWP and CPU to ARM64:
This git repo has an example of this (DLL and Unity project).
Note that the DLL has to be compatible with Universal Windows Platform (UWP), so when creating a new library with Visual Studio, you should select either the DLL (Universal Windows) or Windows Runtime Component project templates as your starting point.
If you add any dependencies to your DLL, e.g., for point cloud registration, you will also have to build those libraries for UWP / ARM64, and add those DLLs to the same folder as well!

Unity: use UWP project in unity windows standalone application

I am making a windows standalone application using unity.
I want to record video from PC webcam and save it locally. The only solution that I found is a UWP project that records video and saves it to PC.
I want to know if there is a way to use this UWP solution in my windows standalone application.
For C# projects (not UWP), I build it to dll and use it as dll in my application.
I need to find a way to do just like this with UWP project.
Edit 1:
I tried Unity VideoCapture Example in both editor and build. In unity editor, the application runs without errors but it didn't enter to this function "VideoCapture.CreateAsync()", as they said it didn't work with the editor.
When I tried to build to windows standalone build, it gives me this error :
"Assets/Scripts/Controllers/Other/VideoCaptureExample.cs(4,26): error CS0234: The type or namespace name 'WebCam' does not exist in the namespace 'UnityEngine.XR.WSA'. Are you missing an assembly reference?"
If you are using the HoloToolkit / MRTK, you had best delete that folder and use the newer asset, or better yet, use the Master Branch which has more fixes in it.
Or you can try update your Unity to 2017.2 and the sample works when testing on my machine. 

Automatize archiviation process of an app in Xamarin.Forms

The project that I'm currently developing consists in two different sub-projects: a xamarin.forms application and an aspnet core project used by the first. For now I need only the android version of it, so let us focus only on this aspect. The aspnet project should be able to provide a page where the user can download the .apk. For now I've put the .apk file in a folder in the web project directory and all works perfectly. What I want to accomplish now is to automatize this process: everytime i compile the entire solution, the system itself should prepare the apk package and put it in the right folder. At first it seemed easy, but I've not found a way to do it. Doesn't anyone have tried this, yet? Thanks!

How to deploy a compiled application without Visual Studio?

When I open a sample Blinky application in Visual Studio, compile and run it, it gets automatically deployed to the target configured WindowsIoT device. After that, on Windows 10 machine where I compile it, the application binaries are located in the bin sub-folder of the project folder as one would expect.
I would like to automate the deployment, so that I could run deployment code
without Visual Studio, specify target device and the binaries location and it would deploy it. I cannot find any API that allows
to deploy apps to Windows IoT, how do I do that?
This shiny Windows IoT stuff is a new area, and there is not a lot of info available apart from the samples and the getting started page. Any pointers are appreciated.
Update: As noted in comments, once one start thinking of mass production, they will probably need to conciser ICD. This, is not, however the problem I'm trying to solve currently. I would like to figure out how I can provide Over-the-Air updates to my UWP application running on Raspberry Pi and Windows IoT. I also would you like to know how I can automate build / deployment in general, but that may be automatically solved if I have a proper OTA solution.
There is a set of instructions on how to do it, which can be found in the same github repo you are linking in your question, but in a different folder. Note, that you need an appx for these instructions to work, and it's not created by the solution build by default.
This page provide (non IoT specific) instructions on using VS to build the appx. And this blog post talks about the command line tool that can be used for making appx.
Note, that the last two links are also talking about publishing an application to app store, so you'll need to make some mental adjustments around that.

WPF and Console Application EXEs in same solution

I have a WPF application that is going to be installed on several client PCs. I'm using InstallShield Express Edition as the deployment tool for that.
I've created a different project(DLL) to keep track of the software installations. Basically is a stand-alone C# project that reads, writes and does some validation checking in the Windows Registries, and can be integrated in other WPF applications (this project/DLL is going to be useful for other Apps).
What I want to do is to create an .EXE file to register the installation. This .EXE is not used in the main WPF application, but uses the .DLL that I've just talked about above.
I've managed to do that by creating a different solution with a single Console Application project, and referencing the necessary DLL's.
But what I really want is to create it as project within my Main App Solution, and when I do that no .EXE file is generated other than the Main App executable.
Is there anything I can do to get the 2 .EXE files (Main App and InstallationRegistration) or is the way I'm currently using the only way?
This is more a nuisance than a problem, but still... it will be a better way to keep track of this small module in all the different Applications I've developed.
Thanks
Are you saying the Console EXE is not created as part of the build/run of the solution?
Or the Console EXE is not created as part of the InstallShield deployment project?
If you are referring to building Console EXE as part of the build/run of the solution:
Generally, when you hit F5, Visual Studio builds only those projects you designate as Startup and their dependencies.
You will have to explicitly build that Console App or the Entire Solution.
You can designate it as one of your Startup projects if you want it to be built everytime you hit F5; or specify it as a dependency of the MainApp project (that's a bit of a cheat but it gets the job done).
After trying for a few different ways I got to that DUH!!! moment.
What happened is that VS was creating both .EXE files for the Main App and the Console Application, only with each one is in their respective Debug/Release Folder
For Example:
Main App -> C:\Projects\MyApp\MyAppUI\bin\Debug\MyAppUI.exe
Intallation Control.EXE -> C:\Projects\MyApp\InstControl\bin\Debug\InstControl.exe
NOTE: C:\Projects\MyApp is the solution folder.
It kinda makes sense they are on their own folder, but on the other hand, there should be an option in VS to choose where we want to send all the solution's .EXE
Hope it helps someone in the future.
By default, all intermediate compilation artifacts are placed in the obj folder under a given project in the solution (so far I am not aware this can be changed).
For project outputs they are, by default, put under bin\Debug or bin\Release depending on your Build Configuration.
This can however be changed from the Project's Properties; specifically the Build tab has an "Output path" option for you to specify the build output location.
This has to be done on a per project basis but I generally create a SolutionDir\bin folder under the Solution root and direct all project output paths to SolutionDir\bin\Debug or SolutionDir\bin\Release as the case may be. This has the added advantage or reducing the total size of SolutionDir by avoiding multiple copies of output assemblies in large solutions with complex interdependencies between projects.
Does this help?

Categories