# Getting error while building ITK with cmake

**URL:** https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173
**Category:** Beginner Questions
**Created:** [June 12, 2020, 8:58am UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173 "2020-06-12T08:58:18Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Usman\_Saeed](https://discourse.itk.org/user_avatar/discourse.itk.org/usman_saeed/32/1533_2.png) [@Usman\_Saeed](https://discourse.itk.org/u/Usman_Saeed)
#### Post date: [June 12, 2020, 8:58am UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/1 "2020-06-12T08:58:18Z")

</div>

![itkerror](https://discourse.itk.org/uploads/default/original/2X/0/03f20471fe13074e5d50e94ec5a1fdc703ea18ae.png)

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [June 12, 2020, 1:54pm UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/2 "2020-06-12T13:54:40Z")

</div>

In your screenshot, the actual error message is not visible. Copying to the forum the content of the mini-log control at the bottom should provide us with the most information.

---

<div class="post-metadata">

### Author: ![Usman\_Saeed](https://discourse.itk.org/user_avatar/discourse.itk.org/usman_saeed/32/1533_2.png) [@Usman\_Saeed](https://discourse.itk.org/u/Usman_Saeed)
#### Post date: [June 13, 2020, 12:52pm UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/3 "2020-06-13T12:52:25Z")

</div>

The error on the log file further says in CMakeOutput.log

“The system is: Windows - 10.0.18362 - AMD64”

---

<div class="post-metadata">

### Author: ![Cedric](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@Cedric](https://discourse.itk.org/u/Cedric)
#### Post date: [October 4, 2021, 4:40pm UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/4 "2021-10-04T16:40:57Z")

</div>

Hello,  
I have exactly the same error when I want build ITK 5.2 or other with CMake 3.21.  
Is there a solution to fix this or a other way to install ITK?  
Thanks

---

<div class="post-metadata">

### Author: ![codeling](https://discourse.itk.org/user_avatar/discourse.itk.org/codeling/32/2214_2.png) [@codeling](https://discourse.itk.org/u/codeling)
#### Post date: [October 5, 2021, 10:45am UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/5 "2021-10-05T10:45:20Z")

</div>

> [@Cedric](#):
>
> I have exactly the same error

What’s shown above is only the “end result”, not the actual error message. That is shown in the log window some time before.  
You need to scroll up in the log window at the bottom of CMake (or enlarge it), then you should see some text in red with the actual error that occurred which caused CMake to fail.

---

<div class="post-metadata">

### Author: ![Cedric](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@Cedric](https://discourse.itk.org/u/Cedric)
#### Post date: [October 5, 2021, 11:12am UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/6 "2021-10-05T11:12:16Z")

</div>

Oh yes, I see !  
There is the error message:

> CMake Error at CMakeLists.txt:30 (project):
> 
> Failed to run MSBuild command:
> 
> C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
> 
> to get the value of VCTargetsPath:
> 
> ```
> Microsoft (R) Build Engine version 4.8.4084.0
> 
> [Microsoft .NET Framework, version 4.0.30319.42000]
> 
> Copyright (C) Microsoft Corporation. All rights reserved.
> 
> Build started 04/10/2021 18:22:32.
> 
> Project "C:\itk\Build\CMakeFiles\3.21.3\VCTargetsPath.vcxproj" on node 1 (default targets).
> 
> C:\itk\Build\CMakeFiles\3.21.3\VCTargetsPath.vcxproj(14,2): 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.
> 
> Done Building Project "C:\itk\Build\CMakeFiles\3.21.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.
> 
> Build FAILED.
> 
> "C:\itk\Build\CMakeFiles\3.21.3\VCTargetsPath.vcxproj" (default target) (1) ->
> 
> C:\itk\Build\CMakeFiles\3.21.3\VCTargetsPath.vcxproj(14,2): 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.
> 
> 0 Warning(s)
> 
> 1 Error(s)
> 
> Time Elapsed 00:00:00.16
> 
> ```
> 
> Exit code: 1

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 5, 2021, 3:49pm UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/7 "2021-10-05T15:49:45Z")

</div>

> [@Cedric](#):
>
> `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.`

This seems like a broken Visual Studio installation. Can you try “repair” in Visual Studio installer? If that does not help, try uninstalling, then reinstalling.

---

<div class="post-metadata">

### Author: ![Cedric](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@Cedric](https://discourse.itk.org/u/Cedric)
#### Post date: [October 5, 2021, 4:21pm UTC](https://discourse.itk.org/t/getting-error-while-building-itk-with-cmake/3173/8 "2021-10-05T16:21:29Z")

</div>

Oh yes I see !!  
I installed a new visual studio version and now it works.  
Thanks everyone for your help
