Search code examples
c#wpfvisual-studiowarningssetup-project

Fix the WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version C# Setup Project


I received Warning in output console when deploying a project using Setup project in Visual studio 2019 and error as below. "WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework X.X.X'. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#)."

I search this warning in google and found solution by myself, I will share this with you step by step.

Warning Image


Solution

  • This error occurred Setup Project has higher .net framework version than Project. So warning can avoid by adding compatible .net framework for both projects.( Here i change version to 4.5.2) There are 3 places this change need to add.

    1. Main Project(Properties(Right Click) > Application > Target Framework > Select version of desire Framework) Main Project Change

    2. Setup project(Properties(Right Click) > Prerequisites(Click) > Select version of desire Framework) Setup Project Change Select Desire Framework

    3. Setup Project( Detected Dependencies > Microsoft .NET Framework(Double Click) > Properties > Select version of desire Framework) Select Desire Framework

    Then build the project again. TADA warning message won't show again.