AssemblyInfo.cs फ़ाइल AssemblyVersion विशेषता है, लेकिन जब मैं चलाने के निम्नलिखित:प्रतिबिंब का उपयोग करके मैं असेंबली वर्जन विशेषता क्यों लोड नहीं कर सकता?
Attribute[] y = Assembly.GetExecutingAssembly().GetCustomAttributes();
मैं:
System.Runtime.InteropServices.ComVisibleAttribute
System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
System.Runtime.CompilerServices.CompilationRelaxationsAttribute
System.Runtime.InteropServices.GuidAttribute
System.Diagnostics.DebuggableAttribute
System.Reflection.AssemblyTrademarkAttribute
System.Reflection.AssemblyCopyrightAttribute
System.Reflection.AssemblyCompanyAttribute
System.Reflection.AssemblyConfigurationAttribute
System.Reflection.AssemblyFileVersionAttribute
System.Reflection.AssemblyProductAttribute
System.Reflection.AssemblyDescriptionAttribute
और अभी तक मैं जाँच की है अनगिनत बार है कि इस विशेषता में मौजूद है मेरी कोड:
[assembly: AssemblyVersion("5.5.5.5")]
... और अगर मैं इसे तक पहुँचने का प्रयास सीधे मैं एक अपवाद प्राप्त करें:
Attribute x = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyVersionAttribute)); //exception
मुझे लगता है कि मैं उस विशेषता का उपयोग करने में सक्षम नहीं होगा, लेकिन कैसे आइए इसे पढ़ नहीं रहा है?
आप क्या करने की कोशिश कर रहे हैं? 'असेंबली' में पहले से ही 'संस्करण' संपत्ति है। – ashes999
क्या आप निश्चित हैं? मैं न तो –
के साथ एक स्थिर और न ही इंस्टेंस प्रॉपर्टी देखता हूं आपको 'GetName()' example 'var y = assembly.GetExecutingAssembly()। GetName() संस्करण; ' –