我刚把我的VS更新到ver了。16.8.3现在我突然发现了这个错误:
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error :
Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
根本不知道该怎么办。多年来,我们一直致力于这个项目,从未遇到过这样的问题。
有什么想法吗?
似乎问题在于使用多个.net框架的项目,以及使用多个.net框架的项目的引用。
我有一个最小的示例解决方案:我的公共汽车
该解决方案包含两个最小/空项目,它们在技术上是相同的,只不过一个名为Microdesk.DbApp 的项目引用了,一个名为Microdesk.Infrastructure。
当DbApp项目抛出上述错误时,基础设施项目编译得很好。
这个解决方案多年来一直为我们服务,并与最新的版本16.8.3断绝关系。
发布于 2020-12-22 14:49:20
好吧,部分是我的错。我重新编译了空的示例项目,发现尽管编译器出错,但解决方案确实生成了。
1>------ Rebuild All started: Project: Microdesk.BIMrxCommon.Infrastructure, Configuration: Debug2020 Any CPU ------
1> Microdesk.BIMrxCommon.Infrastructure -> C:\Work\Microdesk.BIMrx\bin\Debug2020\Microdesk.BIMrxCommon.Infrastructure.dll
2>------ Rebuild All started: Project: Microdesk.BIMrxCommon.DbApp, Configuration: Debug2020 Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error : Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
2> Microdesk.BIMrxCommon.DbApp -> C:\Work\Microdesk.BIMrx\bin\Debug2020\Microdesk.BIMrxCommon.DbApp.dll
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
但如果您试图在引用DbApp项目中使用基础设施项目中的任何内容,那么解决方案将不会编译
Rebuild started...
1>------ Rebuild All started: Project: Microdesk.BIMrxCommon.Infrastructure, Configuration: Debug2020 Any CPU ------
2>------ Rebuild All started: Project: Microdesk.BIMrxCommon.DbApp, Configuration: Debug2020 Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1720,5): error : Internal MSBuild error: Non-CrossTargeting GetTargetFrameworks target should not be used in cross targeting (outer) build
2>C:\Work\Microdesk.BIMrx\BIMrxCommon\Microdesk.BIMrxCommon.DbApp\DerivedClass.cs(1,29,1,4
): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'Microdesk.BIMrxCommon' (are you missing an assembly reference?)
2>C:\Work\Microdesk.BIMrx\BIMrxCommon\Microdesk.BIMrxCommon.DbApp\DerivedClass.cs(5,33,5,42): error CS0246: The type or namespace name 'BaseClass' could not be found (are you missing a using directive or an assembly reference?)
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
我确实将名为"Microdesk.BIMrx (2).zip“的第二个示例项目上载到了前一个OneDrive目录
发布于 2020-12-21 09:14:01
当我在你这边测试你的问题时,我并没有像你描述的那样面对同样的行为。因此,我想,由于更新,您当前的vs环境存在一些问题。也许更新破坏了VS的一些工具。
因此,请尝试以下步骤对其进行故障排除:
建议
( Extensions-->Manage Extensions-->Installed ) 1)禁用任何第三方安装的扩展
2)关闭VS,删除.vs
隐藏文件夹,项目的每个bin
和obj
文件夹。
并删除C:\Users\xxx(current user)\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache
下的所有缓存文件。
然后,重新启动VS以再次测试。
3)或创建一个新项目,然后将内容从旧项目迁移到新项目,以测试该问题是否与您的VS或特殊项目本身有关。
4)如果这不起作用,对VS执行初始化操作。
关闭VS,删除C:\Users\xxx(current user)\AppData\Local\Microsoft\VisualStudio\16.0_xxx
下的整个用户文件夹,然后重新启动VS以再次测试。
5)来自vs_installer的 修理vs
https://stackoverflow.com/questions/65224195
复制相似问题