问题描述
您好,我是
我上周末开始遇到这个问题(之前我没有遇到过这个问题)。我没有安装Windows或Visual Studio 2017的任何更新,所以这些问题不应该因此而开始。
问题是我实际上不能建设和部署我的两个Xamarin.Forms Android项目因为我不断得到一个"ResolveLibraryProjectImports"错误。这是我得到的与此相关的堆栈跟踪:
1> C:\Program Files(x86)\ Microsoft Visual Studio \\\ 2017" Professional \ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:"ResolveLibraryProjectImports"任务意外失败。
1> C:\Program Files(x86)\ Mysoftoft Visual Studio \\\ 2017; \\ Professional \ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common .targets(1091,2):错误MSB4018信息:System.UnauthorizedAccessException:访问路径 'obj\Debug\__library_projects__\FastAndroidCamera\library_project_imports'
被拒绝
1> ; C:\Program文件(x86)\Microsoft视觉Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2):错误MSB4018:   在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)
1> C:\Program Files(x86)\ Microsoft Visual Studio\2017 \Professional\MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:  在System.IO.Directory.InternalCreateDirectory(String fullPath,String path,Object dirSecurityObj,
Boolean checkHost)
1> C:\Program Files(x86)\ Microsoft Visual Studio \\ \专业\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:  在System.IO.Directory.InternalCreateDirectoryHelper(字符串路径,布尔checkHost)
1> C:\Program文件(x86)\Microsoft视觉Studio\2017\Professional\MSBuild\ Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:  在System.IO.Directory.CreateDirectory(字符串路径)
1> C:\Program Files(x86)\ Microsoft Visual Studio\2017 \Professional\MSBuild\Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:  在Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver RES,ICollection`1
罐子,ICollection`1 resolvedResourceDirectories,ICollection`1 resolvedAssetDirectories,ICollection`1 resolvedEnvironments)
1> C: \Program Files(x86)\ Microsoft Visual Studio \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\  在Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
1> C:\Program文件(x86)\Microsoft视觉Studio\2017\Professional\MSBuild\Xamarin\ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018:  在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1> C:\Program文件(x86)\Microsoft视觉Studio\2017\Professional \ MSBuild\Xamarin \ Android \ Xamarin.Android.Common.targets(1091,2):错误MSB4018: &NBSP;在Microsoft.Build.BackEnd.TaskBuilder。< ExecuteInstantiatedTask> d__26.MoveNext()
基本上,看起来构建过程失败,因为它没有权限访问'obj\Debug\__library_projects__\FastAndroidCamera \library_project_imports'目录。我仔细检查了这个目录的安全性,它应该具有读/写
功能,所以我认为这必须是某种突然发生的文件锁定问题。
之前是否有人遇到此问题,若然,我该如何解决?我已经尝试了我能想到的一切(清理解决方案并在尝试构建之前重新启动我的PC,在尝试构建之前删除受影响项目的obj / bin文件夹,删除
并恢复NuGet包,升级Visual Studio 2017到最新版本,卸载并重新安装Visual Studio 2017)并且没有任何作用,所以我在这一点上非常沮丧(我不知道还有什么可以尝试/看看,此时)。 br />
问候,
Keegan
Hello,
I started running into this issue late last week (and I hadn't been encountering the issue before then). I didn't install any updates to Windows or Visual Studio 2017, so these issues should not have started because of that.
The issue is that I can't actually build & deploy two of my Xamarin.Forms Android projects because I keep getting a "ResolveLibraryProjectImports" error. This is the stack trace I get that is related to this:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: System.UnauthorizedAccessException: Access to the path 'obj\Debug\__library_projects__\FastAndroidCamera\library_project_imports' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at System.IO.Directory.CreateDirectory(String path)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1091,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Basically, it looks like the build process fails because it doesn't have permissions to access the 'obj\Debug\__library_projects__\FastAndroidCamera\library_project_imports' directory. I double checked the security of this directory, and it should have read/write capabilities, so I'm thinking this has to be some sort of file locking problem that just started happening all of a sudden.
Has anyone encountered this issue before, and if so, how can I fix it? I've tried everything I can think of (cleaning the solution & restarting my PC before trying to build, deleting the obj/bin folders of the projects affected before trying to build, deleting and restoring NuGet packages, upgrading Visual Studio 2017 to the latest version, uninstalling & reinstalling Visual Studio 2017) and nothing works, so I'm getting pretty frustrated at this point (and I'm not sure what else to try/look at, at this point).
Regards,
Keegan
推荐答案
欢迎来到MSDN fourm。
Welcome to MSDN fourm.
由于本论坛将讨论MSBuild(主题包括:MSBuild的使用,构建自定义和MSBuild通过任务,记录器和托管的可扩展性,我们很难确定它是否与VS,项目本身
或其他相关,我没有直接的解决方案,但是我想提供一些麻烦:
Since this forum is to discuss the MSBuild(Topics including: usage of MSBuild, build customization, and MSBuild extensibility via tasks, loggers and hosting), it is hard for us to make sure that whether it is related to the VS, the project itself or others, I have no direct solution for this issue, but I would like provide your some troublestootings:
1。检查您的项目以查看是否有任何损坏的引用。 (标有黄色三角形)删除所有损坏的参考文献。重新编译。对我们来说,错误是VS使用这种误导性错误"ResolveLibraryProjectImports"不正确地报告了破坏的引用。
任务意外失败'。
1. Check your projects to see if there are any broken references. (marked with yellow triangle) Delete all broken references. Recompile. For us, the bug is that VS improperly reports broken refs with this misleading error '"ResolveLibraryProjectImports" task failed unexpectedly'.
2。请打开管理CMD窗口并导航到C:\Program Files(x86)\ Microsoft Visual Studio\2017 \ Enterprise.com \Common7 \IDE并运行以下命令:
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; devenv / safemode
它可以防止Visual Studio启动时加载所有第三方VSPackage,从而确保稳定执行。如果有效,则此问题应由扩展程序引起,您需要删除工具扩展程序和更新下的已安装扩展程序。
2. Please open an administrative CMD window and navigate to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE and run these commands:
devenv /safemode
It prevents all third-party VSPackages from loading when Visual Studio starts, thus ensuring stable execution. if it works, this issue should be caused by the extensions and you need to remove the installed extensions under Tools—Extensions and Updates.
3 。如果它无法在安全模式下运行,请尝试删除或重命名以下文件夹:
C:\ Users \<您的用户名称> \ AppData \本地\\ \\ Microsoft /\\ VisualStudio \ 15.0
$
C:\ Users \<您的用户名称> \ AppData \Roaming\Microsoft \ VisisStudio \15.0
¥b $ b同时,以管理员身份运行visual studio,禁用计算机上的任何Anti-Virus或Anti-Spyware软件并清除%temp%文件夹。
3. If it doesn’t work in safe mode, please have a try with delete or rename the following folders:
C:\Users\<your users name>\AppData\Local\Microsoft\VisualStudio\15.0
C:\Users\<your users name>\AppData\Roaming\Microsoft\VisualStudio\15.0
Meanwhile, run visual studio as administrator, disable any Anti-Virus or Anti-Spyware software on your computer and clean %temp% folder.
4。重新安装Xamarin.Forms。
4. Reinstall Xamarin.Forms.
5。从磁盘C中创建一个新的空白项目,例如 D.将脚本复制到新项目,然后构建它,检查它是否有效。
5. Create a new blank project out of disk C, for example, D. Copy scripts to the new project, then build it, check if it works.
此外,由于您正在开发Xamarin.Android项目,我建议您可以在$上打开一个新线程b $ b 论坛。
Besides, since you are developing the Xamarin.Android project, I suggest that you can open a new thread onXamarin forum.
希望这会有所帮助。
这篇关于Visual Studio 2017建筑&部署问题 - Xamarin Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!