简体   繁体   English

如何更改visual studio项目的目标?

[英]How to change target of visual studio project?

There is a visual studio solution, which is a host-container for react native.有一个视觉工作室解决方案,它是一个用于反应原生的主机容器。 There are 7 projects in the solution解决方案中有7个项目

  1. ChakraBridge (Universal Windows, C++)脉轮桥(通用 Windows,C++)
  2. Facebook.Yoga.Shared Facebook.Yoga.Shared
  3. ApplicationMobile (Universal Windows, C#) ApplicationMobile(通用 Windows,C#)
  4. ReactNative (Universal Windows, C#) ReactNative(通用 Windows,C#)
  5. ReactNative.Shared ReactNative.Shared
  6. ReactNativeWebViewBridge (Universal Windows, C#) ReactNativeWebViewBridge(通用 Windows,C#)
  7. yoga.uwp (Universal Windows, c++) Yoga.uwp(通用 Windows,c++)

All the projects targeting 14393 version:针对 14393 版本的所有项目: 在此处输入图像描述

On compile I have lot of errors, that can be grouped in three types:在编译时我有很多错误,可以分为三种类型:

  1. Predfined type "System.String" is not defined or imported未定义或导入预定义类型“System.String” 在此处输入图像描述

  2. Your project does not reference "UAP,Version=v10.0.14393" framework.您的项目未引用“UAP,Version=v10.0.14393”框架。 Add a reference to "UAP,Version=v10.0.14393" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.在项目文件的“TargetFrameworks”属性中添加对“UAP,Version=v10.0.14393”的引用,然后重新运行 NuGet 恢复。 for ApplicationMobile适用于应用移动

  3. Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Universe 类型无法解析程序集:System.Runtime,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a。 for react native用于反应原生

On my machine windows 1809-17663 is installed.在我的机器上安装了 windows 1809-17663。 I have tried to install the latest WDK, solution failed to build.我已尝试安装最新的 WDK,但无法构建解决方案。 I have changed the target version to 1809-17663 for all the projects in the solution, the application successfully built and run, however later discovered, that some features work only under 14393. I have installed SDK for 14393, from here https://developer.microsoft.com/en-us/windows/downloads/sdk-archive , but still has all the errors from above.我已将解决方案中所有项目的目标版本更改为 1809-17663,应用程序成功构建并运行,但后来发现,某些功能仅在 14393 下工作。我已经为 14393 安装了 SDK,从这里https developer.microsoft.com/en-us/windows/downloads/sdk-archive ,但仍然有上面的所有错误。 Does somebody know how to build projects targeting 14393 when I am on windows 17663?当我在 windows 17663 上时,有人知道如何构建针对 14393 的项目吗?

to sum up总结一下

  1. Download 14393 SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archivehttps://developer.microsoft.com/en-us/windows/downloads/sdk-archive下载 14393 SDK
  2. Set build target and min version to 14393 for all projects将所有项目的构建目标和最低版本设置为 14393
  3. right-click on the solution -> retarget solution -> set target to 14393右键单击解决方案 -> 重定向解决方案 -> 将目标设置为 14393
  4. Restart visual studio重启视觉工作室

details细节

On my machine windows 1809-17663 is installed.在我的机器上安装了 windows 1809-17663。 I have tried to install the latest WDK, solution failed to build.我已尝试安装最新的 WDK,但无法构建解决方案。 I have changed the target version to 1809-17663 for all the projects in the solution, the application successfully built and run, however later discovered, that some features work only under 14393. I have installed SDK for 14393, from here https://developer.microsoft.com/en-us/windows/downloads/sdk-archive , but still has all the errors from the question.我已将解决方案中所有项目的目标版本更改为 1809-17663,应用程序成功构建并运行,但后来发现,某些功能仅在 14393 下工作。我已经为 14393 安装了 SDK,从这里https developer.microsoft.com/en-us/windows/downloads/sdk-archive ,但仍然存在问题中的所有错误。

Finally, I have accidentally seen an option in solution properties, retarget solution, on the screen it is disabled because project was running when making a screen.最后,我无意中看到解决方案属性中的一个选项,重新定位解决方案,在屏幕上它被禁用,因为在制作屏幕时项目正在运行。

在此处输入图像描述

  1. Retarget solution to 14393将解决方案重新定位到 14393
  2. Restart visual studio重启视觉工作室
  3. Unload/Load project ApplicationMobile (maybe optional:))卸载/加载项目ApplicationMobile(可能是可选的:))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio建模项目上更改目标框架? - How do I change the Target Framework on a Visual Studio Modeling Project? Visual Studio扩展项目:如何更改目标Visual Studio版本? - Visual Studio extension project: how to change target Visual Studio version(s)? 如何在Mac的Visual Studio中更改目标框架? - How can I change the target framework in Visual studio for Mac? Visual Studio - 多目标时更改目标框架 - Visual Studio - Change target framework when multitargeting Visual Studio扩展-如何在解决方案\\项目项选择更改上进行监听 - Visual Studio Extension - How to listen on Solution \ Project item selection change Visual Studio 2017-如何更改现有项目的.NET版本? - Visual Studio 2017 - how to change .NET version of existing project? 如何通过Visual Studio在GitHub中更改项目类型? - How to change project type in GitHub through Visual Studio? 如何在 Visual Studio 中更改整个解决方案的项目名称? - How to change whole solution's project's name in Visual Studio? 在Visual Studio中对具有不同目标平台的另一个项目的项目引用 - Project reference to another project with different target platform in Visual Studio 如何在Visual Studio 2015 RC中将目标平台更改为Windows Phone 8.0 - How to change target platform to Windows Phone 8.0 in Visual Studio 2015 RC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM