Solved

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

Posted on 2014-09-08
9
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 40311191
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
ID: 40311226
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
ID: 40311806
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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 40
ID: 40311934
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
 
LVL 4

Author Comment

by:Thunder724
ID: 40311953
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
ID: 40312013
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
ID: 40312420
Thanks very much, that did the trick.
Does anyone else find it frustrating that Microsoft isn't keeping there framework consistant?
0
 
LVL 40
ID: 40312526
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
ID: 40312622
Yup.
Thanks very much again for you help.

Cheers.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

622 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