# Compile and run slicer in vs2022, and the prompt “Access Denied” appears

**URL:** <https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833>\
**Category:** Development\
**Created:** [February 22, 2025, 9:07pm UTC](https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833 "2025-02-22T21:07:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhuofalin](https://avatars.discourse-cdn.com/v4/letter/z/82dd89/32.png) [@zhuofalin](https://discourse.slicer.org/u/zhuofalin)\
**Post date:** [February 22, 2025, 9:07pm UTC](https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833/1 "2025-02-22T21:07:41Z")

</div>

I compiled slicer on two windows (one is win10 and the other is win11). At that time, I could compile and run slicer normally using vs2022. However, after a few days, when I compiled and ran slicer again, it prompted access denied. What’s going on? Note: The operating environment has not changed.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [February 25, 2025, 12:14pm UTC](https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833/2 "2025-02-25T12:14:04Z")

</div>

Do you have any other thing to show? The exact error message, a full log? Thanks!

---

<div class="post-metadata">

**Author:** ![zhuofalin](https://avatars.discourse-cdn.com/v4/letter/z/82dd89/32.png) [@zhuofalin](https://discourse.slicer.org/u/zhuofalin)\
**Post date:** [February 25, 2025, 2:22pm UTC](https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833/3 "2025-02-25T14:22:48Z")

</div>

Sorry for the late reply. This mainly prompts the following error screenshot, but I haven’t found the log yet. Whether it is compiled by cmake or ninja, this error is reported when compiled in vs2022.

 ![屏幕截图 2025-02-25 211134](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/2/62fc0b28d0feba9c3f5b2526017c1ce40cd09a1f.jpeg)  
 ![屏幕截图 2025-02-25 222151](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/9/d96b892cb01085c027cef98ea237b7669f260ec1.jpeg)

I have tried running vs2022 as an administrator and then running slicer in debug, or changing the folder properties to no longer read-only, but the problem cannot be solved.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [February 25, 2025, 2:41pm UTC](https://discourse.slicer.org/t/compile-and-run-slicer-in-vs2022-and-the-prompt-access-denied-appears/41833/4 "2025-02-25T14:41:30Z")

</div>

It seems that you forgot to specify the startup project, and probably the executable as well

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/c/9cef3f06e4316cd9b172f417f6079c1807af863f.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/1/9101a2b4f51fe6238a42c708ce272271b75aa64a.png)

This is explained here btw  
[https://slicer.readthedocs.io/en/latest/developer\_guide/debugging/windowscpp.html](https://slicer.readthedocs.io/en/latest/developer_guide/debugging/windowscpp.html)
