Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm using the Visual Studio 2017 to build a Web site.
When I start my Project I've noticed that there was no any Assembly Information File.
Thus I couldn't load and retrieve the Attributes I need.
Therefore I've create a sub-folder Named `My Project` And I've put inside a file named `AssemblyInfo.vb` which it looks like that:
<Assembly: AssemblyTitle("ffffffff")>
<Assembly: AssemblyDescription("ddddddddd")>
<Assembly: AssemblyCompany("ccccccccccc")>
<Assembly: AssemblyProduct("hhhhhhhhhhhhh")>
<Assembly: AssemblyCopyright("Copyright © gggggggggg")>
<Assembly: AssemblyTrademark("vvvvvvvvvv")>

<Assembly: ComVisible(True)>

<Assembly: Guid("53a50112-05e2-43c2-b98c-d86d10b00048")>
<Assembly: AssemblyVersion("1.0.27.3")>
<Assembly: AssemblyFileVersion("1.0.27.3")>
<Assembly: NeutralResourcesLanguage("en")>

From that point I use my code behind in order to `get` the informations I need.
And in the line
Dim asm As Object = Nothing
	asm = Assembly.LoadFrom(AsseFile)

Throws me the error of:
Quote:
Could not load file or assembly 'file:///D:\WorkOnD\Work\Adata\Project\EKKEROSS\entry\entry\My Project\AssemblyInfo.vb' or one of its dependencies. The module was expected to contain an assembly manifest.


Please Is someone to assist me on this? My programming is in `vb.net`

What I have tried:

Search in the web for solution but nothing comes to my knowledge.
Posted
Updated 4-Feb-19 6:57am

1 solution

Assembly.LoadFrom expects the path of a compiled assemby - a .dll file. You're passing in the path of your source file - a .vb file.

If you want to get the attributes from the current assembly, use:
VB.NET
Dim asm As Assembly = Assembly.GetExecutingAssembly()

Assembly.GetExecutingAssembly Method (System.Reflection) | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
Maciej Los 4-Feb-19 15:58pm    
5ed!
I'd like to add this link to MSDN documentation: Best Practices for Assembly Loading | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900