LESS in Web Compiler for Visual Studio 2019 stopped to work - visual-studio

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.

Related

Publish to AWS Lamba - Failed to find the "build-lambda-zip" utility

I'm currently trying to publish my AWS lambda functions using Visual Studio 2019 community (v4.8.03752) and leveraging the AWS Toolkit for Visual Studio (v1.20.1.0). After right clicking my project and selecting 'Publish to AWS Lambda' I receive the following error:
- Zipping publish folder C:\Users\Matt\source\repos\programName\programName\.\bin\Release\netcoreapp3.1\publish to C:\Users\Matt\AppData\Local\Temp\HelloWorld-CodeUri-Or-ImageUri-637489827969959200.zip
- Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
- Error packaging up project in C:\Users\Matt\source\repos\programName\programName\. for CloudFormation resource HelloWorld: Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
I've been able to deploy this MANY times over previous months, up until Friday 2/12 when I started receiving this error (after a reboot). What's even more strange is that if I uninstall the AWS Toolkit for VS, then reinstall it, I'm able to publish successfully 1 time. With my 2nd attempt, I begin to receive this error again.
Steps I've taken to attempt to resolve:
Repair Visual Studio
Uninstall/Reinstall Visual Studio
Uninstall and reinstall amazon.lambda.tools using dotnet tool install -g Amazon.Lambda.Tools
Uninstall AWS Toolkit for VS, Reinstall toolkit. (This works for first deployment, fails when trying to deploy a 2nd time)
UPDATE:
Per some comments below, it looks like this is being caused by McAfee Real-Time Scanning. In checking the logs during a deployment I noticed a "Virus or threat found" record that points directly to the build-lambda-zip.exe file. To permanently avoid this issue moving forward please follow the steps provided by user2174794 in the comments below.
I'm having the same issue. Just started happening today. It was working within the last 2 weeks.
Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
Running Windows 10, Visual Studio 2019
My solution for now is to use the .NET Core CLI
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/lambda-cli-publish.html
Specifically, the
dotnet lambda deploy-function
A recent update must have broke the AWS Toolkit For Visual Studio.
I have the same problem, it was because my antivirus detect the executable build-lambda-zip.exe, then delete it.
I restore the executable from my antivirus, or restore dotnet tools with the command :
dotnet tool update -g Amazon.Lambda.Tools
I also faced the same issue,
This is because the "build-lambda-zip.exe" file is getting removed by the McAfee Antivirus.
For the permanent fix, you need to follow the below steps.
Step 1
Go to McAfee Settings >> Quarantined Items
You will find the "build-lambda-zip.exe" file there. Restore it to the original location.
Now If you will try to publish, the error won't get displayed. But again on the next scan, the file will get removed.
Step 2
We need to Exclude this file from getting Scanned and removed. So for that,
Go to McAfee Settings >> Real-Time Scanning and Add the "build-lambda-zip.exe" file in the Excluded files list.
For the file path of "build-lambda-zip.exe" got to
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\ and search for the file name.
Maybe you should try reinstalling the AWS Tool Kit and before you make deployments please turn off your antivirus protection. I was troubbling the same issue and my antivirus(McAfee) was deleting build-lambda-zip.exe file when I did deployment first time.
I'm curious about the state of the extension installation. Can you go to VS's extension directory in Windows explorer C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions and in the search box search for AWSToolkitPackage.dll.
Ideally it should only show one instance of that file. Assuming it finds a single instance right click on the file and select "Open File Location". Now that you are in the root folder of the AWS extension check the Resources folder and see if it contains the file build-lambda-zip.exe.
I know the question is in a windows system, but under a linux system, in my case the following command was needed:
sudo apt-get -y install zip

error Build: File 'COMPUTE_PATHS_ONLY.ts' not found in 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

Open solution that contains long file paths

After building Bootstrap v4-alpha with npm, Visual Studio can no longer open my project, because the file paths are too long. It just hangs.
Bower installs bootstrap here:
C:\Users\BigFont\Documents\GitHub\2015-113MH\webapp\src\webapp\wwwroot\lib\bootstrap
That's fine. The problem arises after building bootstrap with npm. After deleting the bootstrap directory, Visual Studio can open the project, but I do not want to delete the directory.
How can we use Visual Studio with long path names?
Edit
My current workaround is to use Visual Studio Code, because it can handle long file paths.
I have resorted to creating folders at the root of my C:\ drive. I also use 7zip to delete folders to get around the 'file path too long' errors. You can open 7zip, click on the folder you want to delete and hit the Shift+Del keys.
NPM 2.0 creates nested folders that are very deep. Consider upgrading to NPM 3.0 as this fixes this problem and tries to create a folder structure that is as flat as possible.
If you are using Visual Studio 2015 RTM, it comes with NPM 2.0. NPM 3.0 will not be released with VS until the next update. You can still install NPM 3.0 but it is a little more involved. See this blog post for a step by step guide to install.

How to fix '"CheckAttributes" task could not be loaded'-error after installing Visual Studio 2013 Update 4

After installing Update 4, I now find myself unable to build (or even clean) any solution. I keep getting:
Error 1 The "CheckPathAttributes" task could not be loaded from the
assembly C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll.
Could not load file or assembly 'file:///C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll'
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. HandlePageNotFound
Does anyone know how to resolve this please?
Well, here's "my solution".
First the horrific "prompt of death" (plus the same "licensing issue" annoyance) in this post:
What I've attempted (and result) based on info from the interwebs:
Close VS 2013 and rename the folder:
C:\Users\[your user name]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache
Result: No effect/errors persist (VS will re-create that folder on startup)
Rerun the Visual Studio Update 4 installer and Repair
Result: Successfully "fixed" whatever it was.
This will take about an hour which is slower than when I originally installed the update so that was a clue, or rather, more like "well, I hope that means it found what it did wrong or forgot/missed out on" (and not, "oh crap, now I'm really screwing things up even more")
A quick summary of my environment so that hopefully will guide you to your solution:
I did install Office Developer Tools Nov 2014 prior to the Update so in my case, that wasn't the issue (I did not remove/uninstall)
I have Resharper, and I did not disable it, so this too doesn't seem related (some have pointed this out)
I did update to Web Essentials 2013 for Update 4 after the initial Update (it will prompt you to after installing VS Update 4). I didn't do anything after the Repair (didn't remove/re-install/etc Web Essentials after the Repair).
I have VS 2012 as well, just mentioning this though that was never affected in any way (and was my fallback while this issue was stopping me from using VS2013)
Hth...
Found the solution via this
TransformXml task could not be loaded from Microsoft.Web.Publishing.Tasks.dll
In my case, I had Visual Studio 2012 installed on an E: drive already, so I found a copy of Microsoft.Web.Publishing.Tasks in
E:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web
So I copied that file, and Microsoft.Web.XmlTransform to here:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web
and now all is well :)
Uninstalling "Office Developer Tools for Visual Studio 2013 – November 2014 Update" helped me. Now all works as before.
If you have VS 2012 installed on your machine. Copy Microsoft.Web.Publishing.Tasks.dll and Microsoft.Web.Publishing.targets from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\web\ into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web (the path for VS 2013). Restart visual studio.
I have only VS2013 (now with Update 4) and I solve this problem as follows: Close VS, copy "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.Dll" into the "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web" directory and start VS (folder v11.0 no contains Web subfolder). Now I can rebuild website projects without any error again.
My problem cleared thanks to the same TransformXml link and the suggestion to install Windows SDK for Windows 7 and .NET Framework 4
Copying "Microsoft.Web.Publishing.Tasks.dll" and "Microsoft.Web.XmlTransform.dll" from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web" to "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web" also works

NPM Install (Windows) throws .SLN errors...?

I'm working with Node.js (and a couple other node modules) and I've come across this problem in multiple different projects now...
With a lot (not all, but many) of node modules, when I try to install a module I get a similar error to this:
C:\...\.node-gyp\0.8.16\deps\uv\include\uv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:\...\AppData\Roaming\npm\node_modules\soap\node_modules\node-expat\build\binding.sln]
Project : warning PRJ0018: The following environment variables were not found: [C:\...\AppData\Roaming\npm\node_modules\soap\node_modules\node-expat\build\binding.sln]
With more than coincidental frequency, Node-Gyp seems to have something to do with it, I think... However I can't find anything suggesting what exactly would cause this.
I'm running:
-Node 0.8.x (Which I need for one of our custom modules),
-NPM 1.1.69
-Windows 7 x86
Examples of which modules I'm trying to use:
-npm install soap
-npm install nodetime
Stumbled upon the reason. For Node-gyp to install properly on a Windows machine, you need Visual Studio C++ 2010 (Express or full suite). At a glance, I assumed this meant the MS C++ Redistributable packages, not the IDE.
I have VS2008 installed, but 2010 is the minimum requirement. Hope this helps saves someone else from a headache or two in the future, though!

Resources