Forum Visual Studio

Error adding files

I created a project originally in Visual Studio but my trial of Xamarin ran out and I bought the Indie license which doesn't allow Visual Studio support so I'm trying to use Xamarin Studio now instead. My project compiles and runs but I cannot add new files to it. Every time I choose Add -> Add Files... I get the below error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: path2
at System.IO.Path.Combine(String path1, String path2)
at MonoDevelop.Core.FilePath.Combine(String[] paths)
at MonoDevelop.MonoDroid.MonoDroidProject.GetDefaultBuildAction(String fileName)
at MonoDevelop.Ide.ProjectOperations.AddFilesToProject(Project project, FilePath[] files, FilePath[] targetPaths, String buildAction)
at MonoDevelop.Ide.ProjectOperations.AddFilesToProject(Project project, FilePath[] files, FilePath targetDirectory, String buildAction)
at MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderCommandHandler.AddFilesToProject()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at MonoDevelop.Components.Commands.DefaultCommandHandler.Run(Object target, Command cmd)
at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.Run(Object target, Command cmd)
at MonoDevelop.Ide.Gui.Components.NodeCommandHandler.TransactedNodeHandlerAttribute.Run(Object target, Command cmd)
at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.MonoDevelop.Components.Commands.ICommandTargetHandler.Run(Object target, Command cmd)
at MonoDevelop.Components.Commands.CommandHandlerInfo.Run(Object cmdTarget, Command cmd)
at MonoDevelop.Components.Commands.CommandManager.<>c__DisplayClassb.b__2()
at MonoDevelop.Components.Commands.CommandManager.DispatchCommand(Object commandId, Object dataItem, Object initialTarget, CommandSource source)

I can add files by manually hacking the XML in the project file but that is a pretty big pain to do when I have a lot of files to add. Any idea how to resolve this?

Posts

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    Which version of Xamarin Studio is this? I'm going to file a bug - this shouldn't be happening.

  • mhutchmhutch USMember, Xamarin Team Xamurai
    edited September 2013

    It looks like support for empty values of the <MonoDroidAssetsPrefix> property got broken, and that property got removed from your csproj somehow. I've now fixed the bug, and you can work around it by adding this to your project's main <PropertyGroup>:

    <MonoDroidAssetsPrefix>Assets</MonoDroidAssetsPrefix>
    
  • Version is 4.0.12 build 3.

    I'll try that hack to the csproj file tonight and let you know if it works. Thanks!

  • KristoforSteeleKristoforSteele USMember
    edited September 2013

    I added <MonoDroidAssetsPrefix>Assets<MonoDroidAssetsPrefix> and it didn't resolve the issue.

    When you say you fixed the bug, where do I get the fix from?

  • mhutchmhutch USMember, Xamarin Team Xamurai

    Sorry, you'll have to wait for the next Xamarin Studio update.

    Did your csproj file have the MonoDroidAssetsPrefix element at all? Where did you add it?

  • KristoforSteeleKristoforSteele USMember
    edited September 2013

    It didn't have it before I added it.

    If you want I can email you the entire csproj file (tried to post XML here but even in a code block, it removes many of the elements). I added it in the first PropertyGroup node.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    Could you please open a bug and attach the project file?

Sign In or Register to comment.