Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopyRealmWeaver target fails when creating Android package on CI server #656

Closed
grahampett opened this issue Jun 23, 2016 · 5 comments
Closed
Assignees

Comments

@grahampett
Copy link

grahampett commented Jun 23, 2016

Goal

Build signed Android Xamarin app on TeamCity CI server (Mac OS) following Xamarin documentation to use SignAndroidPackage target, e.g.:

/Library/Frameworks/Mono.framework/Commands/xbuild /p:Configuration=Release /p:Platform=AnyCPU /target:SignAndroidPackage MyProject/MyProject.csproj

Expected Results

Signed package generated

Actual Results

Target CopyRealmWeaver:
CopyRealmWeaver
Creating directory '/Tools'
{path to project - removed}/packages/Realm.0.76.1/build/Realm.targets: error : Access to the path "/Tools" is denied. at System.IO.Directory.CreateDirectoriesInternal (System.String path) <0x1a20c10 + 0x00148> in :0
at System.IO.Directory.CreateDirectory (System.String path) <0x1a20a00 + 0x000c7> in :0
at Microsoft.Build.Tasks.Copy.CreateDirectoryIfRequired (System.String name) <0x3d947a8 + 0x0008b> in :0
at Microsoft.Build.Tasks.Copy.Execute () <0x3cef478 + 0x0037f> in :0
Task "Copy" execution -- FAILED

Steps & Code to Reproduce

See https://developer.xamarin.com/guides/cross-platform/ci/teamcity/#Compiling_Android_Applications

Have attempted running manually in a terminal on my own MacBook and it still fails with the same error, so not related to permissions of the build agent.

Version of Realm and tooling

Realm version(s): 0.76.1

Xamarin/Visual Studio version: Xamarin Studio 6.0.1

Which operating system version and device: Mac OS X El Capitan

@fealebenpae
Copy link
Member

Hey @grahampett,

When building a project directly with xbuild the SolutionDir MSBuild property is not set, but the CopyRealmWeaver target depends on it because Fody looks for weaver assemblies in $(SolutionDir)/Tools. The fix is to add /p:SolutionDir=/path/to/solution/folder to your xbuild invocation.

@grahampett
Copy link
Author

Thanks, that works.

@fealebenpae
Copy link
Member

I'm reopening this in order to track this as an issue to improve our documentation.

@superphil0
Copy link

superphil0 commented Apr 13, 2017

Hey, if someone stumbles over this, on macOS (or maybe also linux) the solution dir has to have a trailing slash
/p:SolutionDir=/Users/vagrant/git/a/ <--- trailing slash

at least when building with bitrise CI, sorry didn't know where to post this best

@Dids
Copy link

Dids commented Apr 18, 2017

@superphil0 Thanks, looking into that now as well. It actually looks like xbuild isn't adding the trailing slash for SolutionDir, but is doing so for other variables. Could be an oversight (bug) in xbuild by the looks of it. This can technically also be fixed in the RealmWeaver too though.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants