无法为Android构建“ Hello World” Xamarin应用

eko*_*lis 0 c# android visual-studio xamarin

我收到此错误:

Severity    Code    Description Project File    Line    Suppression State
Error       The "Javac" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.LongPathHelper.Normalize(String path, UInt32 maxPathLength, Boolean checkInvalidCharacters, Boolean expandShortPaths)
   at System.IO.Path.NewNormalizePath(String path, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.FileInfo.Init(String fileName, Boolean checkHost)
   at System.IO.FileInfo..ctor(String fileName)
   at Xamarin.Android.Tasks.ZipArchiveEx.AddFiles(String folder, String folderInArchive)
   at Xamarin.Android.Tasks.ZipArchiveEx.AddDirectory(String folder, String folderInArchive)
   at Xamarin.Android.Tasks.Javac.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() XamarinApp1.Android     
Run Code Online (Sandbox Code Playgroud)

我的应用程序的名称为XamarinApp1;肯定不会太久?

这是开箱即用的默认Xamarin Android XAML项目。我只是试图建立它...

Gus*_*avo 5

打开Android .csproj,然后插入此PropertyGroup,并用计算机中的短路径替换IntermediateOutputPath。MSBuild将在此处“ E:\ temp \ MyApp”创建输出文件。

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseShortFileNames>True</UseShortFileNames>
    <IntermediateOutputPath>E:\temp\MyApp</IntermediateOutputPath>
  </PropertyGroup>
...
Run Code Online (Sandbox Code Playgroud)

如果您想了解有关此错误的更多信息,请查看:

如何解决PathTooLongException错误?

较短的内部路径名(实验性)