Solved

"getentryassembly is not a member of system.reflection.assembly"

Posted on 2014-09-08
9
354 Views
Last Modified: 2014-11-12
Hi all,
I'm trying to create a Windows Phone Application in VS2013.
It seems every reference to a object from any library/Namespace I get an error that the object is not a member when it should be.  I add the imports for the namespace and objects and nothing helps.  If I create a an Windows App, non Windows Phone App, and use the same namespaces it works fine.

For instance.....
Imports System.Reflection

Public Function GetVersionNumber( as String)

Dim assem as Assembly = Assembley.GetEntryAssembly
...
...
end function

Assembley.GetEntryAssembly errors because the "GetEntryAssembly" is not a member.

I tried using different Framework versions also; without any luck.
0
Comment
Question by:Thunder724
  • 4
  • 4
9 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
According to the documentation, GetEntryAssembly is not supported in .net framework for Windows Phone.
What about using GetExecutingAssembly instead?
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getexecutingassembly(v=vs.110).aspx
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
You have to be careful about what you use when working with Windows Phone or Windows Store (the new Windows 8 interface). The framework they use is not the same as the framework that is used on PCs for Windows Applications. Many namespaces and classes are not available. And for those that are, many methods, properties and events are missing.

As Jaime pointed out, you need to check the documentation carefully when working in an environment such as Windows Phone. Most pages in the documentation have a list of supported platforms toward the bottom of the page. When Windows Phone is not listed, it does not apply to your current project.

This being said, GetExecutingAssembly might not be what you are looking for if GetEntryAssembly was your first goal. If the code is running in a dll, GetExecutingAssembly will get information about the dll. If you want information about the application that is calling the dll, you can use GetCallingAssembly. According to the documentation, it is supported in Windows Phone since version 7.0.
0
 
LVL 4

Author Comment

by:Thunder724
Comment Utility
I'm in agreement with both of your points; but my problem is that the NameSpaces do not have methods, or I should say only a limited and useless amount of methods.  For Instance the System.Reflection.Assembly NameSpace only has three methods (Equals, Load, ReferenceEquals).  I'm seeing this with other NameSpaces as well. I do not see this happening in other types of projects and I've even tried it in C# with the same results.  I'm wondering if there is something wrong with my VS2013 enviornments.  I have tried this and other things on two different computers.  Would there be a reason that the methods would not be presenting themselves properly.

thanks.
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
My answer to your question was based on the documentation.

I created a new Windows Phone application on VS2013, and I end up having the same results as the ones you get. Even the sample code in the documentation is not acceptable.

Looking around, information is scarce, but it seems that the stuff has been dropped from the WinRT framework, and Windows Phone 8 applications are Store application. I have found something similar to the following in a few places:

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/1f774a9e-39e0-4f3b-aead-661468465d51/reflectionassemblygetcallingassembly-gone-for-good?forum=winappswithcsharp

It looks as if the thing was removed, but the documentation was not updated.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 4

Author Comment

by:Thunder724
Comment Utility
I just wanted to get the application version.  Other code, I try seems to have the same issue.
Thanks very much though for trying the project yourself.  At least I can be failure confident that my development enviornment is stable.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
Comment Utility
Then, no need to get the assembly. I am not in an environment where I can test it, but according to the documentation:

Dim ver As Windows.ApplicationModel.PackageVersion = Package.Current.Id.Version
0
 
LVL 4

Author Comment

by:Thunder724
Comment Utility
Thanks very much, that did the trick.
Does anyone else find it frustrating that Microsoft isn't keeping there framework consistant?
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
Yes, it is frustrating, but Just think about it.

You do not have on a phone the same power, memory and disc space as you have on a computer. The OS cannot be sophisticated on such a little footprint, otherwise nothing would be left for the applications to run on.

What I find the most frustrating is when the documentation tells you that something is supported and it isn't.

The way they have been going for the last few years, it looks as if they want everybody to drop the desktop and fallback on WinRT and Azure. The competition is pushing at their back, and they end up going too fast and giving us tool that are not up to the task.

Not counting the fact that they keep changing the basics. I have not worked with phone applications, but did give a look at WinRT. They completely reworked the basic templates between Windows 8 and Windows 8.1. And when you hear about Visual Studio 2014, they are going Native .NET, once again, a new way to do things. This is the kind of thing that frustrates me.

When the framework came out in 2002, it was not perfect, but it had a solid base and simply evolved from there, every 2 years or so. Nowadays, every new version of Visual Studio brings new paradigms to do same things, showing indirectly that what was there before was crap. And they are coming every year. This is what frustrates me.
0
 
LVL 4

Author Comment

by:Thunder724
Comment Utility
Yup.
Thanks very much again for you help.

Cheers.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now