Writing a .NET DLL how do I find Application.ProductName?
EDIT:
Obviously, importing Windows.Forms could solve the problem, but my DLL have nothing to do with Windows Forms.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
Applicationclass just needs a reference toSystem.Window.Forms. So the simpler way is to add that reference in your *.dll and use the property.However if you are not allowed to reference the Windows Forms library you can somewhat replicate the functionality in a custom class of yours and read the AssemblyProductAttribute from the assembly you consider to be your application. For a console application you would consider the assembly returned from
Assembly.GetEntryAssemblyto be your application.