error Build: File 'COMPUTE_PATHS_ONLY.ts' not found in visual studio - visual-studio

I received the following error after the repair of visual studio 2015.
Error Build: File 'COMPUTE_PATHS_ONLY.ts' not found.
COMPUTE_PATHS_ONLY.ts is not from my Git repo. Other files in the Git repo have not changed. What could it be?

I found answer here, it works for me: https://github.com/Microsoft/TypeScript/issues/7445
the error indicates that there is a mismatch between your targets (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets) and the tasks dll (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.Tasks.dll); this would be an issue with the installer not handling a specific order of installing different versions.
Can please try:
uninstall TS 1.8.* from Add/Remove Programs
uninstall TS 1.7.* from Add/Remove Programs
make sure the folder C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript is empty, if not remove it manually
install TS 1.7.6 again, you should see the folder created in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript

For me the solution was to move the folder at
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript
to
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript
and overwrite everything there.

This answer helped me a lot, I could solve my problem this way
When I removed "COMPUTE_PATHS_ONLY" from the
line Configurations="$(TypeScriptBuildConfigurations)
COMPUTE_PATHS_ONLY" in the file Microsoft.TypeScript.targets, my
problem was solved.

The steps mentioned above will not guarantee to fix your issue. After following the steps mentioned above I was keep getting the same compiler error.
I restarted my machine after "uninstall and install" operation but no luck.
Finally, I found that instead of doing all these from control panel we have to do it from package manager (Right Click on solution and select "Manage Nuget packages for solution.."
First uninstall the TS package for your project from package manager and then install the package and build.
Img of project setting

I was using the VS 2015 update_1 and type script version 1.8
For me it was solved by updating VS 2015 in update_3
https://msdn.microsoft.com/en-us/library/mt752379.aspx

Related

LESS in Web Compiler for Visual Studio 2019 stopped to work

It worked for years.
Yesterday for no reason (?) I'm not able to compile LESS files any more.
I tried to
reinstall the Web Compiler extension,
reinstall Web Essentials 2019 extension,
reinstall the whole Visual Studio 2019 for 3 times,
start a new project from scratch
I do not know if some automatic update happened under the hoods, but basically, every time I try to compile a LESS file I get:
module.js:471
throw err;
^
Error: Cannot find module 'C:\Users\igor\AppData\Local\Temp\WebCompiler1.12.394\node_modules\less\bin\lessc'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
Thanks for any help!
For VS2017 and VS2019:
Uninstall the Web Compiler extension
Delete* the directory C:\Users\<username>\AppData\Local\Temp\WebCompiler1.12.394
Install Web Compiler
I do not know why the "lessc" file disappeared.
* From cmd.exe:
rd /S %LOCALAPPDATA%\Temp\WebCompiler1.12.394
From a PowerShell prompt:
rm -r $env:LOCALAPPDATA\Temp\WebCompiler1.12.394
How I found the solution: I attempted to re-create the .vsix file from the GitHub repository for the Web Compiler extension so that I could get the lessc file; I had installed Node.js and all its associated gubbins. Trying to use the node_modules.7z generated by build.cmd in the Web Compiler files didn't work in the end because there are several deprecated things in it - I ended up with the error described in 3.10: Breaks IE Compat Option. So I thought: oh dear, it is all broken, why not just delete the directory and try the install again?
I deleted the C:\Users\<username>\AppData\Local\Temp\WebCompiler1.12.394 folder and ran the compilation from Task Runner Explorer which recreated the folder without having to reinstall Web Compiler.
Maybe it is related to also having the BuildWebCompiler 1.12.405 NuGet package installed in the project.
I was able to fix a similar problem with a "node-sass" file missing from the Web Compiler (although the entire bin folder was empty) by performing the following actions:
close Visual Studio 2019
delete the C:\Users<username>\AppData\Local\Temp\WebCompiler1.12.394 folder
restart Visual Studio.
When I restarted VS, the folder was recreated with all the necessary files back where they needed to be.
When I ran into the issue I had just came back to work after taking a little over a week off. At least for me, I think a program on my computer that automatically cleans up unused temp files may have been the culprit.

NuGet package restore failed when building Windows Calculator

I am trying to build Windows Calculator (Microsoft/Calculator on GitHub) with Visual Studio 2017 Community version. I followed the instructions but got an error message starting with:
NuGet Package restore failed for project Calculator: Unable to find version '1.0.2' of package 'Microsoft.WindowsCalculator.PGO'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.WindowsCalculator.PGO.1.0.2' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
https://api.nuget.org/v3/index.json: Package 'Microsoft.WindowsCalculator.PGO.1.0.2' is not found on source 'https://api.nuget.org/v3/index.json'.
Please see Error List window for detailed warnings and errors.
(......build started and failed)
I checked nuget.config found in the repo and it mentions https://eeapps.blob.core.windows.net/eeapps/index.json, which did not appear in the error message. It seems to me that nuget failed to check this location for packages. How do I restore the missing packages?
NuGet package restore failed when building Windows Calculator
To resolve this issue, you should add the specify nuget source (https://eeapps.blob.core.windows.net/eeapps/index.json) to the Package Source in the Visual Studio:
Tools->Options->NuGet Package Management->Package Source:
Then you can see those packages:
Now, you can restore the nuget packages with the options Restore NuGet Packages when you right click on your solution file.
Hope this helps.
After some research I realized the problem actually has nothing to do with NuGet.
I cloned the repo with git on WSL (Ubuntu app), and after reading this answer I retried cloning with Git on Windows and the problem simply disappears.
It seems that git clone on WSL and Visual Studio just don't get along. Related GitHub issue here.

"C:\Microsoft.Cpp.Default.props" was not found

I have a project created in Visual Studio, 2013.
The project file has the following properties:
ToolsVersion="12.0",
PlatformToolset = v120.
I have Visual Studio 2013 and Microsoft Build Tools 2015 installed.
This project gets successfully built using MSBuild 12.0. Upon the attempt to build it with MSBuild 14.0 I get an error
MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
As I understand, the problem is that the variable VCTargetsPath doesn’t get evaluated. If I specify the variable VCTargetsPath before the build (with the value C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120), the problem is solved.
However, this approach is not very convenient in case the path is different. Is it possible to somehow solve the problem in a more optimal way?
The registry key and its value:
HKLM\Software\WOW6432Node\Microsoft\MSBuild\ToolsVersions\12.0\VCTargetsPath $([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V120\'))
This will usually solve the problem:
Run on an elevated command prompt (admin):
npm install --global --production windows-build-tools.
npm is required and my recommended package manager.
Change ownership of the install dir (in my case C:\Program Files (x86)\MSBuild\14.0) to your user, instead of admin. (properties>Security>Advanced).
Sometimes step 2 is unnecessary. It is still recommended to avoid having to use admin console for some commands.
I recently reinstalled Visual studio 2017 and encountered this issue while trying to install "npm java".
The fix for me is:
set ms version to 2017: npm config set msvs_version 2017
set VCTargetsPath environment variable to C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets
run command console as system administrator
These steps solved my issue:
Run npm install --global --production windows-build-tools
Run npm install --save nan
Set VCTargetsPath environment variable to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
For those using VS 2019:
set VCTargetsPath="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160"
Edit (Sep 2020):
Sometimes it requires a trailing backslash (as bmiller mentioned below)
For those the above answer does not work, here is another possible solution to look at.
Even the installation of build tools or VS 2015 did not work for me. So I tried installing below directly via PowerShell (as admin)
https://chocolatey.org/packages/visualcpp-build-tools/14.0.25420.1
Command:
choco install visualcpp-build-tools --version 14.0.25420.1
Once this was installed, set an environment variable VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140
I solved this by:
Set VCTargetsPath environment variable to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
build using admin
I could not make it work with all the suggestions on this page
I downgraded nodejs to 10.15 and it worked fine
probably not the best answer but it works
When running MSBuild outside of Visual Studio 2019 (migrated from 2012), I had these kinds of problems.
I solved them running this MSBuild:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild"
(customize it based on your VS version and target architecture) instead of this one:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild
that I was using when I had Visual Studio 2012.
I solved the problem by loading the solution in VS 2019 instead of double-clicking the solution name in File Explorer.
My specific problem was using "yarn install" and during the build process, it was trying to build the node_modules node-sass component using MSBuild, and failing.
I would get the following error: "error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk."
This makes sense on a new developer machine with only Visual Studio 2022 installed. After investigating the node-sass module's build\binding.sln file, it appeared indicate that it requires Visual Studio 2015 VC++ Build Tools.
I then downloaded the "Visual C++ Build Tools for Visual Studio 2015 with Update 3" DVD image from Microsoft. After I installed it, it seemed to solve the problem, no PATH or registry changes required. When I ran "yarn install" again, building the module node-sass completed properly.
First I went to the path and confirmed that I didn't have that file. I was able to get that file by
opening the Visual Studio Installer,
clicking on "Modify" of the current installation
selecting "C++ Clang-cl v142 build tools (x64/x86)" under the Individual Components" tab.
Confirm the installation by clicking the "Modify" button
I tried npm install and VCTargetsPath, all not work. Finally solved after it after upgrading visual studio to the latest version.
Resolved by installing Visual Studio Express 2015 for Windows 10.
This happened for me when I used node version 14.15.3, install Node Version Manager, install lower Node version (8.x.x for example), switch to it and that should solve the issue.
After calling VS2019's vcvarsall.bat, it is necessary to use VS2019's MSBuild instead of the one in C:\Windows.
set VCVARSALL=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat
call "%VCVARSALL%" amd64
set MSBUILD=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe
rem set MSBUILD=%FrameworkDir%\%FrameworkVersion%\msbuild.exe
In my case, the reason was that the system environment variable VisualStudioVersion was pointing to the removed version of Visual Studio.
The same solution was building ok from inside the Visual Studio but failed when building with the command-line MSBuild.
The problem was solved by changing the environment variable manually.
I have VS 2019 and I met the same problem trying to install module 'keytar' on Windows 10. This is what I did in order to solve the problem:
Opened "Visual Studio Installer" and removed extra 2017/2019 build tools (for example "Visual Studio Build Tools 2017", restarted the PC
Got back into "Visual Studio Installer" / "Visual Studio Professional 2019" / "Modify" and added "Desktop development with C++" workload
Got into project folder with my problem, removed node_modules folder
Opened CMDO
As #TheRennen suggested performed the command:
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\
(without quotation marks and with one backslash at the end)
run yarn command and now there were no errors.
I think now it a time to add VCTargetsPath into Windows env values.
node v14.19.0, npm 7.20.5, yarn 1.22.15
I have faced this issue while building my flutter application. The issue arises because of the program in my case flutter was unable to locate the file "Microsoft.Cpp.Default.props" which is required for building flutter apps in windows.
For solving the issue install MicroSoft Visual Studio(not Visual Studio code) from the below url.
https://visualstudio.microsoft.com/downloads/
Make sure to check the below option before starting installation.
After installation go to below directory.
C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Microsoft\VC
Note : I have installed community version of 2022 Visual Studio. The folder structure may be different based on your VS version
You can see few folders with version numbers
Open the folder and check which one have the "Microsoft.Cpp.Default.props" file . For my case it was the last folder v170. Open Environment variable and set "VCTargetsPath" variable with path to the folder in which "Microsoft.Cpp.Default.props" is present. Save path and restart the build process. This should work.
Make sure to use --global with the command in order to be able to use this package anywhere.
This solves the issue for me
While checking the .vcxproj file, I noticed the ToolsVersion was missing. I added it and it solves the issue.
Before :
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
After :
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

unable to install xamarin from vs 2015 setup

I have vs 2015 upgrade 1 installed and I try to install Xamrin from the setup, but when I try to install it, at the end receive this error message:
C#/.Net Xamarin
The installer has encountered an unexpected error installing this package. This may indicate a problem with package. The error code is 2711.
how can I solve this?
I had the same error. The error is due to old Xamarin installer files in the cache.
C#/.Net Xamarin The installer has encountered an unexpected error installing this package. This may indicate a problem with package. The error code is 2711.
I did the following steps to fix it:
Note: a folder could be hidden, so enable show hidden items in the windows explorer.
Delete any Xamarin related folders from
"C:\ProgramData\Microsoft\VisualStudioSecondaryInstaller\14.0\installers" folder.
For example:
C:\ProgramData\Microsoft\VisualStudioSecondaryInstaller\14.0\installers\XamarinVS
C:\ProgramData\Microsoft\VisualStudioSecondaryInstaller\14.0\installers\XamarinVSV1
If the first step doesn't help then try to do the following below.
Delete all Xamarin related folders or files from windows temprorary folders TMP and TEMP.
You could find the temprorary folders in the Windows/Control Panel/ System/Advanced/Enviroment variables
I found that solution in comments section here:
https://blogs.msdn.microsoft.com/visualstudio/2016/03/31/mobile-app-development-made-easy-with-visual-studio-and-xamarin/#comment-142062
You can try a manual install by downloading and installing the following:
http://download.xamarin.com/XamarinforVisualStudio/Windows/Xamarin.VisualStudio_4.0.1.147.msi

NuGet.exe pack gives access to the path is denied

When I try to pack my MVC project (NuGet.exe pack) I get:
NuGet.exe : Access to the path '...' is denied.
This happens to be the case for all files in the content and script folder of my MVC solution. If I remove the readonly flag on all these files NuGet.exe is able to create the NuGet package.
Why do I have to remove the readonly flag? Is there another way?
I'm using TFS which specify the readonly flag on all files under source control.
I am running:
NuGet Version: 1.7.30402.9028
Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel
I'm using the NuGet.exe that you get when you install the NuGet package NuGet.CommandLine which is located at http://nuget.org/packages/NuGet.CommandLine.
Apparently, you need to set ReadOnly=false for the files it accesses
Try running it as administrator.
I ran into this with nuget restore after doing a git clean -fd with VisualStudio open: the packages/ directory was marked for deletion, and while several files were deleted, the packages/ folder itself was not as VisualStudio had the .nupkg files open.
Once I closed VisualStudio and re-ran git clean, it removed the packages/ directory and then nuget was able to restore everthing correctly.
In my case something happened when switching branch in git. Everyone lost execute permissions for Nuget.exe.
This blog post helped me: http://mannysiddiqui.wordpress.com/2013/05/11/nuget-access-is-denied-command-existed-with-code-5/
I was running into a similar problem. I attempted to restart Visual Studio, Run as Administrator (Which I always do), Set the folder attributes to ensure the 'Read-Only' flag was off. Regardless, whatever I did, I still encountered the error "access to the path is denied" when updating my Nu-Get packages.
I was able to fix the issue by updating packages one-by-one. Choosing instead to go through each dependency and updating it. Once the dependency was updated I would choose another, sometimes the same error resulted in which case I would choose another until all my packages were successfully updated.
It appears in my case the Nu-Get packages had to be updated in a particular order.
Hope this helps someone out there
I had this problem and it turned out windows had an update waiting for the next restart. Cleared with no problem after restarting and waiting for the update.
My collegue just got this error, during all "worked on my machine". After some research I found out that the *.nuspec file for some reason wasn't added to the version control.
In order to Restore nuget packages, remove read only permissions from the folder level (for windows). Clean the solution and Build. It will works
In my case it was *.gitattributes in the git repo root recently modified (incorrectly), so git started to checkout nuget.exe on the build server and converted all LF to CRLF inside, making it non-executable.
Run your Visual Studio with administrator rights.

Resources