Sometimes you need to debug an app with a Debug version of Uno. This is useful if you need to understand a certain behavior from Uno and pin-point de source using the debugger and eventually test some changes on a real application.
To do this, you need to recompile your app using a debug version of Uno (or a Release version if you prefer).
Instead of tweaking your app solution to reference the your custom Uno output (because there's many steps to follow and you will have to avoid commiting this to source control), we found a simpler way: override the nuget output folder.
** THIS PROCEDURE WILL ONLY WORK WITH PROJECTS USING project.json
NUGET SYSTEM. **
- In your application project (the one referencing Uno):
- Make sure to build at least once (to ensure the nuget packages are downloaded)
- Check in the
project.json
file to get the version of theUno.UI
package. The file should look-like this:-> In this example, the version is... "dependencies": { "CommonServiceLocator": "1.3", "Uno.UI": "1.3.15142-dev", "Uno.UI.Tasks": "2.10.13115", ... }, ...
1.3.15142-dev
.
- Create a file named
nuget_version_override.txt
and in the solution folder (whereUno.UI.sln
is) and put the version number in it - on the first line and nothing else is the file. - Build the project for the platform you need (or build all the solution to get all of them). See below for list of project to compile for each platform...
- Never commit the
nuget_version_override.txt
into source control. It should be ignored by default anyway.
Platform | Solution Folder + Project |
---|---|
Android (Xamarin) | Uno.UI / Uno.UI.Android |
iOS (Xamarin) | Uno.UI / Uno.UI.iOS |
WARNING You may need to clean your
%USERPROFILE%\.nuget\Packages
folder after you finished, just to make sure other apps referencing the same version of Uno won't get weird results.
There is a known issue for this project: Visual Studio is locking the dll file, so you cannot easily debug it.
The easiest way to debug it is :
- Configure the
nuget_version_override.txt
as described above (If you try to debug using the Uno SampleApp you don't have to do anything as it's already configured) - Close/kill all your devenv.exe, msbuild.exe, and Uno.SourceGeneration.Host.exe
- Open a new Visual studio an open only the project src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj
- In the Debug tab of the project settings configure those:
- Start external program:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
- Command line argmuents:
[PATH_TO_YOUR_PROJECT/SOLUTION_FILE] /p:Configuration=Debug
- Start external program:
[PATH_TO_YOUR_PROJECT/SOLUTION_FILE] can be relative to the output folder of the Uno.UI.Tasks project, so ..\..\..\..\SamplesApp\SamplesApp.Droid\SamplesApp.Droid.csproj
will build the Android SampleApp