Currently, I am working on a .net core 3.1 (netcoreapp3.1) razor pages project that includes typescript files and a few javascript files. The project builds perfectly from Visual Studio 2019 (professional) as well as from the command line using MSBuild.
However, when attempting to build from a "deployment" folder where the project has been checked out from source control, I encounter several typescript errors. These errors are of the following nature:
error TS2315: Build:Type 'JQuery' is not generic.
error TS2702: Build:'JQuery' only refers to a type, but is being used as a namespace here.
error TS2339: Build:Property 'css' does not exist on type 'string'.
(please note: one of the above errors is more frequent than the other two)
It seems like the jquery typing files are not being detected properly. They are clearly mentioned in the .csproj file:
<ItemGroup>
<PackageReference Include="jquery.TypeScript.DefinitelyTyped" Version="3.1.2" />
<PackageReference Include="jqueryui.TypeScript.DefinitelyTyped" Version="1.5.1" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
The tsconfig.json also seems normal:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"skipLibCheck": true,
"outDir": "../Source"
},
"exclude": [
"node_modules"
]
}
Edit: I have tried getting a fresh copy of the entire solution from source control into a new directory, performed nuget restore, dotnet restore, and msbuild /t:restore without success. MSBuild continues to fail with the same set of errors. Building the solution in VS2019 works fine without any errors.
At this point, I am unsure of what to investigate next. Does anyone have any suggestions on what could potentially be going wrong?