# CMake C# WPF outputType is "Exe", this is console application

**URL:** <https://discourse.cmake.org/t/cmake-c-wpf-outputtype-is-exe-this-is-console-application/8076>\
**Category:** Code\
**Tags:** os:windows, gen:vs\
**Created:** [May 8, 2023, 3:02pm UTC](https://discourse.cmake.org/t/cmake-c-wpf-outputtype-is-exe-this-is-console-application/8076 "2023-05-08T15:02:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perijahh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/perijahh/32/3418_2.png) [@Perijahh](https://discourse.cmake.org/u/Perijahh)\
**Post date:** [May 8, 2023, 3:02pm UTC](https://discourse.cmake.org/t/cmake-c-wpf-outputtype-is-exe-this-is-console-application/8076/1 "2023-05-08T15:02:31Z")

</div>

Hi,

I have a CMake project with C# and C++ targets.

It’s similar to this example here:

> **[GitHub - bemehiser/cmake\_csharp\_example: CMake C#/.NET WPF and WinForms Examples](https://github.com/bemehiser/cmake_csharp_example)**
>
> CMake C#/.NET WPF and WinForms Examples. Contribute to bemehiser/cmake\_csharp\_example development by creating an account on GitHub.

If you change the .net framework to 4.8 by adding this before the WPF executable is added:  
set(CMAKE\_DOTNET\_SDK “Microsoft.NET.Sdk”)  
set(CMAKE\_DOTNET\_TARGET\_FRAMEWORK “net48”)

Then the OutputType changes to “Exe”.  
In Visual Studio this is a Console Application.

I need OutputType to be WinExe instead. How do I achieve this?

Adding this:  
SET\_PROPERTY(TARGET ${PROJECT\_NAME} PROPERTY VS\_GLOBAL\_OutputType “WinExe”)

Doesn’t help. It adds a second entry to the project.  
Adding WIN32 to add\_executable doesn’t help either.

How should I fix this?

Thanks!

Emiel

---

<div class="post-metadata">

**Author:** ![Perijahh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/perijahh/32/3418_2.png) [@Perijahh](https://discourse.cmake.org/u/Perijahh)\
**Post date:** [May 9, 2023, 2:12pm UTC](https://discourse.cmake.org/t/cmake-c-wpf-outputtype-is-exe-this-is-console-application/8076/2 "2023-05-09T14:12:25Z")

</div>

It seems this issue was fixed in a nightly build.
