WPF learning-Create a new project after customizing Main () [Type ' App ' already defines a member called ' Main ' with the same parameter types]

Source: Internet
Author: User

Problem point:

Add the Main method in App.xaml.cs, the following error will appear in compiling:

Error CS0111 Type "APP" has defined a member with the same parameter type named "Main"

Error Type ' App ' already defines a member called ' Main ' with the same parameter types

The error CS0017 program defines multiple entry points. compile with/main (specifying the type that contains the entry point).

Reason:

When you create a new WPF project by default, the main method is automatically generated at compile time (in App.g.i.cs).

How to resolve:

In the App.xaml property, modify the Build Action ApplicationDefinition to page. It's OK to compile again.

"The WPF project was compiled at compile time, and the Microsoft Msbuild:compile build tool did different processing depending on the configuration (ApplicationDefinition or Page). 】

MSBuild Related references: https://msdn.microsoft.com/zh-cn/library/dd393574.aspx

Msbuid Extension: Https://github.com/mikefourie/MSBuildExtensionPack

WPF learning-Create a new project after customizing Main () [Type ' App ' already defines a member called ' Main ' with the same parameter types]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.