[设置项目时,在npm run build
上出现此错误:
C:.. \ src \ packages \ Microsoft.Portal.Tools.5.0.303.3330 \ build \ TypeScript \ tools \ Microsoft.TypeScript.targets(219,5):错误MSB4062:“ TypeScript.Tasks.CheckFileSystemCaseSensitive”无法从程序集中加载任务C:.. \ src \ packages \ Microsoft.Portal.Tools.5.0.303.3330 \ build \ TypeScript \ build .. \ tools \ net45 \ TypeScript.Tasks.dll。无法加载文件或程序集“ Microsoft.Build.Utilities.Core,版本= 14.0.0.0,文化=中性,PublicKeyToken = ..'或其中之一依赖性。该系统找不到指定的文件。确认那个该声明是正确的,该程序集及其所有依赖项可用,并且该任务包含一个公共类实现Microsoft.Build.Framework.ITask的代码。[C:.. \ src \ Default \ Extension \ Extension.csproj]
Package.json
{
"name": "extensiondev",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"restore": "npm install --no-optional && nuget install ./packages.config",
"build": "msbuild.exe ./Extension.csproj /m /p:RunBundlerInDevMode=true /t:Rebuild /flp1:logfile=msbuild.log /flp2:logfile=msbuild.err;errorsonly /flp3:logfile=msbuild.wrn;warningsonly",
"serve": "node ./node_modules/@../portalhostingservice/DevServer/DevServer.js -s",
"start": "npm run restore && npm run build && npm run serve",
"watch": "cd ./node_modules/.bin && tsc.cmd -b ../../tsconfig.json -w --extendedDiagnostics",
"release": "msbuild.exe ./Extension.csproj /m /p:RunBundlerInDevMode=false;Configuration=Release /t:Rebuild /flp1:logfile=msbuild.log /flp2:logfile=msbuild.err;errorsonly /flp3:logfile=msbuild.wrn;warningsonly"
},
"author": "..",
"license": "..",
"dependencies": {},
"devDependencies": {
"@../portalhostingservice": "1.182.*",
"typescript": "3.2.1"
}
}
感谢您与我们分享详细信息。
MSB4062:“ Typescript.Tasks.CheckFileSysytemCaseSensitive”任务无法从程序集中加载
原因是,当您调用Windows Powershell时,将使用另一个错误的MSBuild版本,而不是相关的VS MSBuild版本。
当调用Windows Powershell来构建VS项目时,应将正确的MSBuild路径配置到系统环境变量中,而VS Developer Powershell和Developer Command Prompt for VS已包含必需的开发环境(相应的工作区所需的运行时以及相应项目所需的DLLS),因此您可以在其中进行构建。
[Since),您在VS IDE中成功构建了扩展项目,我认为您使用的是错误的MSBuild版本,例如Framework MSBuild version
,其中不包含相关的开发环境。
您应该在使用[[VS IDE的过程中使用C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin\MSBuild.exe
。
解决方案>>
<< [1)检查PATH
系统环境变量并删除先前的路径。[2)而是在[[PATH中输入C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin
,然后可以使用Windows Powershell成功构建项目。