0
votes

While setting up a project, getting this error on npm run build:

C:..\src\packages\Microsoft.Portal.Tools.5.0.303.3330\build\TypeScript\tools\Microsoft.TypeScript.targets(219,5): error MSB4062: The "TypeScript.Tasks.CheckFileSystemCaseSensitive" task could not be loaded from the assembly C:..\src\packages\Microsoft.Portal.Tools.5.0.303.3330\build\TypeScript\build..\tools\net45\TypeScript.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=..' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements 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"
  }
}
1
Could you please share the packages.json file with us? Did npm run build use MSBuild to build a new project? - Mr Qian
Also, what version of VS did you use? If you built setup project, you should use devenv xxx.sln /build. Did you use npm run build to build setup project which contains another project called Extension. If so, what your project type of the Extension project? Besides, make sure that you have installed Typescript sdk in VS IDE. You should provide more detailed info about your issue. - Mr Qian
@PerryQian-MSFT Attached Package.json, VS Version: 16.6.0. Yes, I encountered this issue while running npm run build. I was able to build the extension within the IDE but not on Windows Powershell or anywhere outside the Visual Studio IDE. - Richa Dua

1 Answers

0
votes

Thanks for sharing the detailed info with us.

MSB4062: “Typescript.Tasks.CheckFileSysytemCaseSensitive” task couldn't be loaded from the assembly

The reason is that when you call Windows Powershell, you use another wrong MSBuild version rather than the related VS MSBuild version.

When you call Windows Powershell to build VS projects, you should config the right MSBuild path into System Environment Variables while VS Developer Powershell and Developer Command Prompt for VS already contains the necessary development environment(the runtime required by the corresponding workspace and required DLLS for the corresponding project), so you can build in it.

Since you built the extension project successfully in VS IDE, I think you think use a wrong MSBuild version like Framework MSBuild version which does not contain the related development environment.

You should use C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin\MSBuild.exe which is used by VS IDE during the process.

Solution

1) check PATH system environment variables and delete the previous path.

2) Instead, input C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin into PATH, and then you can use Windows Powershell to build your project successfully.