Visual Studio 2017,我安装了所有必需的构建工具。它显示出如下代码
的错误C:nativemyapp>react-native run-windows
Restoring NuGet packages
Building C:/native/myapp/windows/com.tet.windows.sln
Found MSBuild v15.0 at C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0Bin
Building Solution: C:/native/myapp/windows/com.tet.windows.sln
Build configuration: Debug
Build platform: x86
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:nativemyappwindowscom.tet.windowscom.tet.windows.csproj(171,11): error MSB4226: The imported project "C:Program
Files (x86)Microsoft Visual Studio2017EnterpriseMSBuildMicrosoftWindowsXamlv15.0Microsoft.Windows.UI.Xaml.CSha
rp.targets" was not found. Also, tried to find "MicrosoftWindowsXamlv15.0Microsoft.Windows.UI.Xaml.CSharp.targets" i
n the fallback search path(s) for $(MSBuildExtensionsPath) - "C:Program Files (x86)MSBuild" . These search paths are
defined in "C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0binmsbuild.exe.Config". Confir
m that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.
C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEVCVCTargetsMicrosoft.Cpp.Current.targets(1
08,3): error MSB4019: The imported project "C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDE
VCVCTargetsPlatformsWin32Platform.targets" was not found. Confirm that the path in the <Import> declaration is corr
ect, and that the file exists on disk. [C:nativemyappnode_modulesreact-native-windowsFollyFolly.vcxproj]
Build failed with message Error: Command failed: "C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0Binmsbuild.exe" "C:/native/myapp/windows/com.tet.windows.sln" /clp:NoSummary;NoItemAndPropertyList;Verbosity=quiet /nologo /p:Configuration=Debug /p:Platform=x86 /p:AppxBundle=Never /p:PlatformToolset=v141 /p:VisualStudioVersion=15.0. Check your build configuration.
我因开始使用VS 2019而遇到了类似的问题。它说的是转到此文件:
C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0binmsbuild.exe.Config
打开它并找到此节点中的内容:
<projectImportSearchPaths>
<searchPaths os="windows">
更改值以准确导航您的MSBUILD现在的位置。就我而言,更改是:
<projectImportSearchPaths>
<searchPaths os="windows">
<property name="MSBuildExtensionsPath" value="$(MSBuildProgramFiles32)Microsoft Visual Studio2019Enterprise"/>
<property name="MSBuildExtensionsPath32" value="$(MSBuildProgramFiles32)Microsoft Visual Studio2019Enterprise"/>
<property name="MSBuildExtensionsPath64" value="$(MSBuildProgramFiles32)Microsoft Visual Studio2019Enterprise"/>
<property name="VSToolsPath" value="$(MSBuildProgramFiles32)Microsoft Visual Studio2019EnterpriseMSBuildMicrosoftVisualStudiov$(VisualStudioVersion)"/>
</searchPaths>
</projectImportSearchPaths>
值: Microsoft Visual Studio 2019 Enterprise MSBUILD MICROSOFT VISUALSTUDIO
希望它有帮助。