Found .NET SDK, but did not find dotnet.dll - .net-5

I recently installed Visual Studio 2022 preview.
Today I was in a workshop and there was some feature that didn't work, and it turned out it was because I had the preview version of .NET 6 installed.
So I then uninstalled Visual Studio 2022 preview.
Now, when I type dotnet --version (or other command like dotnet --info) in a command window, I get the following message:
Found .NET SDK, but did not find dotnet.dll at [C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\dotnet.dll]
I have tried to repair, and then reinstall DotNet SDK 5.0.400. Restarted machine a few times as well, to no avail.
I am guessing the uninstaller removed the files, but failed to restore the registry to the previous version.
How do I fix this?

So right after posting my question, I discovered that the uninstaller had left some leftovers on my disk. There was a folder with some files, called 6.0.100-preview.7.21379.14. After I deleted it, the command "dotnet --version" now returns "5.0.400".
As Mak wrote below, the folders mentioned reside inside this folder:
C:\Program Files\dotnet\sdk

I also ran into the same problem recently. I had to go to the below path in Windows and delete all 6.*.* folders.
C:\Program Files\dotnet

Related

Flutter windows build: Nuget is not installed

I uninstalled Visual Studio 2019 and installed it as 2022.
I reinstalled Flutter.
When building Flutter desktop, the following problem is repeated.
If I run it in another project, it works without any problem.
Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Nuget is not installed.
Nuget.exe not found, trying to download or use cached version.
1- make sure you have installed Visual Studio
2-
NuGet Package Manager (PM UI and PM Console) is included with Visual
Studio. The latest NuGet releases are delivered as part of Visual
Studio updates.
HOWEVER: nuget.exe itself is not included with any version of Visual Studio.
so you need to download the latest NuGet Windows x86 Commandline from https://www.nuget.org/downloads
3- put it inside the flutter sdk folder or any folder you like
4- copy the folder path
5- in windows serach, search for env so you can put it as system variables. edit path with a new line and past the folder path
6- restart android studio
7- congrats
there's a video on youtube for the exact steps:
https://www.youtube.com/watch?v=J5b5sj6mG8M
Although I don't know why it would work without this error message on the same machine, I recently ran into this issue as well. The way I fixed it was to download the nuget executable and add it to my path.

Qt 5.8 msvc 2015 compile error

I have installed Qt using an offline installer qt-opensource-windows-x86-msvc2015_64-5.8.0. I have visual studio community edition 2017 installed with c++ build tools. because it's compiler was incompatible with the qt version, then I installed visual c++ build tools 2015 from http://landinghub.visualstudio.com/visual-cpp-build-tools . When I try to compile a project it gives an error :-1: error: LNK1158: cannot run 'rc.exe'. Heres how my qt kit looks like,
Can someone figure out whats the mistake and how to fix it.
Thanks.
I've fixed this both on my own machine and on several co-workers machines.
It tends to happen when you have both Visual Studio 2015 and VS 2017 installed. Or more precisely, multiple versions of the Windows SDK installed. When that happens, the vcvars32.bat script (located in your Visual Studio install dir) does not correctly add the location of the resource compiler (rc.exe) to your PATH. Thus, QT Creator runs vcvars32.bat (as specified in Qt Creator under Option->Build&Run->Compilers, but the tools directory for the Windows SDK Kit isn't properly added to the PATH environment.
The simple fix is to add the appropriate version of RC.exe to your path.
Do this from the command line:
cd "c:\program files(x86)"
dir /s rc.exe
You'll get several versions (x86 and x64) and for several versions of the SDK. Add the PATH for where rc.exe lives for the version that corresponds to the SDK and build flavor to your vcvars32.bat startup script.
For example:
PATH="C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86";%PATH%
Restart Qt Creator and that should fix it.
Another fix that worked for me is to uninstall all versions of Visual Studio (and all those side installs of SQL, Windows SDKs, dev tools, etc...). Reboot. Then cleanly install VS 2017 again. Then cleanly uninstall and re-install all of Qt again. That seemed to work for me. A wonderful way to spend an afternoon.
If you update to Qt 5.9 it supports MSVC 2017. However, if you want to get it working with 5.8, I believe you might be missing the Windows SDK. You can download the SDK from Microsoft for Windows 7, 8 or 10, just get whichever version is appropriate for you.
With some googling I found a couple of other somewhat related solutions here, & here, and I've summed them up below:
If you've already got the SDK or installed it and it still doesn't work, it appears that copying rc.exe and rcdll.dll from the WindowsSDK folder to your MSVS installs \VC\bin folder may fix the problem. You might also try copying those same two files to Qt's \Qt*version number**compiler version*\bin.

"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">

Windows 10 SDK won't install to Visual Studio

I've been trying to get Visual Studio and the Windows 10 SDK to work for over a week now. First I couldn't install Visual Studio. That problem was resolved by uninstalling EVERYTHING vaguely related to VS2015, thanks to manually going through everything, but also the Visual Studio "TotalUninstaller".
Plot twist: Now that I've managed to get VS2015 installed and running, I can't get the SDK to install. I've selected it with the installation process, tried to modify VS after, tried to install it with the Standalone installer, but none of it works. Every time, the installer doesn't notice anything wrong, all the tools appear in the start menu, a new "Program Files (x86)/WindowsKits/10.0" folder appears, with all the correct files, but VS can't open any UWP projects, can't create new any, and the SDK doesn't appear in the Extensions list.
When I uninstalled everything, there was only one thing I couldn't get rid of: "Windows 10 for Mobile Image - 10.0.10240.0". It just opens, runs for a second, and closes, achieving nothing in the process. As I couldn't get rid of this, I manually deleted any "Windows Kits" related folder in Program Files, Program Files (x86), ProgramData, and anything in the AppData folder. But this piece of fluffy garbage didn't leave my installed programs list. Could this have something to do with not being able to install the Windows 10 SDK correctly?
I looked in the install logs, and this is the only error I saw:
[371C:398C][2016-08-08T21:13:35]i301: Applying execute package: {7a68448b-9cf2-4049-bd73-5875f1aa7ba2}, action: Install, path: C:\ProgramData\Package Cache\{7a68448b-9cf2-4049-bd73-5875f1aa7ba2}\vsupdate_KB3022398.exe, arguments: '"C:\ProgramData\Package Cache\{7a68448b-9cf2-4049-bd73-5875f1aa7ba2}\vsupdate_KB3022398.exe" -quiet -burn.related.patch -burn.ignoredependencies={248fcd1e-5ee1-421d-893f-ec0a94dd7b01} -burn.ancestors={248fcd1e-5ee1-421d-893f-ec0a94dd7b01}'
[371C:398C][2016-08-08T21:13:35]e000: Error 0x80070003: Failed to create embedded process atpath: C:\ProgramData\Package Cache\{7a68448b-9cf2-4049-bd73-5875f1aa7ba2}\vsupdate_KB3022398.exe
[371C:398C][2016-08-08T21:13:35]e000: Error 0x80070003: Failed to run embedded bundle.
[371C:398C][2016-08-08T21:13:35]e000: Error 0x80070003: Failed to run bundle as embedded from path: C:\ProgramData\Package Cache\{7a68448b-9cf2-4049-bd73-5875f1aa7ba2}\vsupdate_KB3022398.exe
[371C:398C][2016-08-08T21:13:35]e000: Error 0x80070003: Failed to execute EXE package.
[287C:137C][2016-08-08T21:13:35]e000: Error 0x80070003: Failed to configure per-machine EXE package.
It appears in every log when I try to install vs2015 with the right option ticked, or when I use the standalone installer. I've looked in C:\ProgramData\Package Cache and there is no {7a68448b-9cf2-4049-bd73-5875f1aa7ba2} folder, and none of the other folders contain "vsupdate_KB3022398.exe". It looks like this is the root of the problem.
EDIT: I've created the folder that was missing and added "vsupdate_KB3022398.exe" to it (found it online, hosted on a Microsoft server), and there are no more errors left. However, the problem still isn't fixed. The SDK simply refuses to show up. I think I'm going to have to do a clean install.
I had the issue of Windows 10 SDK 14393 failing to install on Windows 7 OS. This problem occurred when installing as part of Visual Studio 2015 and also running the Standalone Installer for the Windows 10 SDK 14393. According to the logs, the Windows Desktop Extension SDK failed to install.
As a work-around I installed Windows 10 SDK 10586 (Installed successfully)
Then I installed Windows 10 SDK 14393 (Installed successfully)
Both versions of the Windows 10 SDK appear as choices under Target Platform Version in Visual Studio 2015 for me.
Apparently the Windows 10 SDK 14393 installer is missing something which it requires to run successfully on Windows 7. (Something that must be present in the previous version)
Sorry for the difficulty. There are 2 known issues that are causing 'Fatal Error' in the Windows SDK install.
See the Windows SDK Tools Issues Forum.
You probably have (had) a pre-release of the SDK and one of the contracts installed is causing MDMerge to fail during setup. Uninstalling the prerelease version of the SDK should avoid this issue.
Thanks,
kevin
I had the MDMerge problem, after uninstalling all previous Windows 10 SDK toolkits, still couldn't install. Fixed it by moving the contents of: "C:\Program Files (x86)\Windows Kits\10", ran the installer again and it installed fine.
This is what I did and it kind of worked for me. Remove everything in the linker ( PROJECT -> LINKER -> Input -> Additional Dependencies, as can be seen in this screenshot

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

Resources