Solved

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

Posted on 2014-09-08
9
400 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

752 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