Skip to content

Instantly share code, notes, and snippets.

View brendanzagaeski's full-sized avatar

Brendan Zagaeski brendanzagaeski

  • Microsoft
  • Boston, MA, United States
View GitHub Profile
@brendanzagaeski
brendanzagaeski / fixconfig.sh
Last active December 28, 2015 17:09
Fix the `config` file within an existing `.pkg` to work around https://bugzilla.xamarin.com/show_bug.cgi?id=16250
#!/bin/sh
PACKAGEPATH="$(ls $1/*.pkg)"
TEMPDIR="$(mktemp -d /tmp/repackage.XXXXXX)"
rmdir "$TEMPDIR"
pkgutil --expand "$PACKAGEPATH" "$TEMPDIR"
APPDIR="$(mktemp -d /tmp/repackage.XXXXXX)"
PAYLOADPATH="$(ls $TEMPDIR/*.pkg/Payload)"
pushd "$APPDIR"
pax -rzf "$PAYLOADPATH"
sed -i "" -e "s:libc.dylib:/usr/lib/libc.dylib:" *.app/Contents/MonoBundle/config
@brendanzagaeski
brendanzagaeski / com.xamarin.mtvs.buildserver.plist
Created November 19, 2013 23:25
Modified /Library/LaunchAgents/com.xamarin.mtvs.buildserver.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>com.xamarin.mtvs.buildserver</string>
modprobe tg3
echo 14e4 1686 >/sys/module/tg3/drivers/pci:tg3/new_i
@brendanzagaeski
brendanzagaeski / add_play_services.bat
Created December 4, 2013 01:34
Windows translation of add_play_services.sh. Pseudo-batchfile.
mkdir google-play-services_lib
cd google-play-services_lib
xcopy C:\Users\_your_username_\AppData\Local\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib .
C:\Users\_your_username_\AppData\Local\Android\android-sdk\tools\android update project -p .
REM Get Ant from http://ant.apache.org/bindownload.cgi
set PATH="%PATH%";"C:\Program Files (x86)\Java\jdk1.6.0_39\bin"
C:\_path_\_to_\ant.bat release
@brendanzagaeski
brendanzagaeski / gist:7817256
Last active December 30, 2015 10:39
Two common build errors about missing properties for new projects in Xamarin.iOS

"Error Application Name is not set in iOS Application Property Page"

"Error Identifier is not set in iOS Application Property Page"

To fix this problem, open the Project Properties, and under the "iOS Application" tab, fill in the "Application Name", "Identifier", and "Version" fields (see also the screenshot of the "Project Properties" -> "iOS Application" settings in the Xamarin docs)

@brendanzagaeski
brendanzagaeski / SafariHistoryPlist.cs
Created December 10, 2013 17:35
Read Safari History.plist using NSPropertyListSerialization in Xamarin C#. See https://github.com/animetrics/PlistCS or http://www.codeproject.com/Tips/406235/A-Simple-PList-Parser-in-Csharp for pure C# alternatives.
var plistFile = System.IO.File.OpenRead("/Users/anyuser/Library/Safari/History.plist");
NSPropertyListFormat format = NSPropertyListFormat.Binary;
NSError error;
NSData plistXml = NSData.FromStream(plistFile);
plistFile.Close();
var plistObject = (NSDictionary)NSPropertyListSerialization.PropertyListWithData (
plistXml,
NSPropertyListReadOptions.MutableContainersAndLeaves,
@brendanzagaeski
brendanzagaeski / XShellUninstallVS.txt
Created December 14, 2013 00:18
Fixing the Xamarin installation after uninstalling the "Xamarin Shell" extension from "Tools -> Extensions and Updates" in Visual Studio
If you uninstall the "Xamarin Shell" extension from "Tools -> Extensions and Updates" in Visual Studio, you will get a "'ShellPackage' package did not load correctly" error even after uninstalling and re-installing both Xamarin VS extensions.
## Cause
Uninstalling the "Xamarin Shell" from "Tools -> Extensions and Updates" sets a value on [1] named "Mono.VisualStudio.Shell,1.0", with the data:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\XAMARIN\SHELL\1.0.0\
[1] Computer\HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\ExtensionManager\PendingDeletions
@brendanzagaeski
brendanzagaeski / FetchRepositoriesWithCompletionArgsNamed.cs
Created January 10, 2014 06:12
Example of a generated Task return value for `[Async (ResultTypeName = "FetchRepositoriesWithCompletionArgs")]` using a named delegate. The names of the return values match the names of the delegate's arguments.
public class FetchRepositoriesWithCompletionArgs {
public bool Success { get; set; }
public NSError Error { get; set; }
public NSArray Repositories { get; set; }
public FetchRepositoriesWithCompletionArgs (bool success, NSError error, NSArray repositories) {
this.Success = success;
this.Error = error;
this.Repositories = repositories;
}
@brendanzagaeski
brendanzagaeski / FetchRepositoriesWithCompletionArgsAction.cs
Created January 10, 2014 06:16
Example of a generated Task return value for `[Async (ResultTypeName = "FetchRepositoriesWithCompletionArgs")]`, using `Action<bool, NSError, NSArray>` as the delegate type. This results in generic return value names like "Arg1".
public class FetchRepositoriesWithCompletionArgs {
public bool Arg1 { get; set; }
public NSError Arg2 { get; set; }
public NSArray Arg3 { get; set; }
public FetchRepositoriesWithCompletionArgs (bool arg1, NSError arg2, NSArray arg3) {
this.Arg1 = arg1;
this.Arg2 = arg2;
this.Arg3 = arg3;
}
@brendanzagaeski
brendanzagaeski / gist:8602459
Created January 24, 2014 17:53
Some steps to try if Xamarin Studio says "Error updating Xcode project. Invalid parameter"
# Some steps to try if Xamarin Studio says "Error updating Xcode project. Invalid parameter"
1. Quit Xcode and Xamarin Studio.
2. Delete the `obj/` folder where Xamarin stores the generated Xcode files (or just the `obj/Xcode` folder, if you prefer)
3. Open the project in Xamarin Studio, and build the project.
4. Try to open the problematic XIB (or storyboard) file.