Solved

Help with accessing .application file using VB.NET

Posted on 2015-02-09
20
55 Views
Last Modified: 2015-02-11
Hi,

I have multiple applications deployed using clickonce technology, which creates applicationname.application. How do I access these applications if they are in the same folder as my application's folder?

Thanks,

Victor
0
Comment
Question by:vcharles
  • 11
  • 6
  • 3
20 Comments
 
LVL 32

Expert Comment

by:ste5an
ID: 40598647
You normally don't. ClickOnce applications are located in the ClickOnce application cache.  This implies a kind of isolation from the rest of the system.

btw, what exactly do you mean by "access these applications"?
0
 

Author Comment

by:vcharles
ID: 40598714
When i click on the .application file (project.application) the project executes, is the a way to execute the file by code from a application folder?  I would like to consolidate multiple application in one application's  folder.
0
 
LVL 32

Expert Comment

by:ste5an
ID: 40598737
ClickOnce is meant to be an easy, somehow lightweight installation. Thus this kind of caching and the implied isolation of the rest of the system.

Okay, now you've got my: How is your application deployed to the application folder (program files)?

Do you want a single ClickOnce package for all applications?
0
 

Author Comment

by:vcharles
ID: 40598762
Yes, I would like one single clickonce package containing multiple project.applications along with their application folders.
0
 
LVL 32

Expert Comment

by:ste5an
ID: 40598779
Choose one of your projects as "master". This means that you add the others either as dependcy or add the compled assembly (.exe) as content to your project.
0
 

Author Comment

by:vcharles
ID: 40598925
Hi,
Is there a way to execute the project.applicqtion files?
Victor
0
 
LVL 40
ID: 40599152
If the entry point is always in the same application, make the other ones dlls that you will distribute with your program. From the entry point, you will have access to all the dlls.

I you write your own Main routines, you might have to change them a bit and maybe give them another name to prevent confusion. Then, call that method as you would call a method in any dll.

If you start your applications by specifying a startup Form, then simply open that startup Form from your entry application as needed.
0
 

Author Comment

by:vcharles
ID: 40599878
Hi,
How do i convert the applications to a dll and execute them using vb.net using butt I n click event?
Thanks,
Victor
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40600159
You convert an application to a dll by changing the Application type to a Class Library in the Application tab of the project's Properties window.

It can be straightforward, or can require minor modifications of the starting code, depending on how each application is launched.

Then, in your main application, you add a reference to each dll.

As I told you before:

I you write your own Main routines, you might have to change them a bit and maybe give them another name to prevent confusion. Then, call that method as you would call a method in any dll.

If you start your applications by specifying a startup Form, then simply open that startup Form from your entry application as needed.


Supposed you were starting in a form, the code of your button would be the following:

Dim frm As New YourDllNamespace.YourForm()
frm.Show

YourDllNamespace would be the namespace of the dll, that is by default the name of the dll, but might have been changed in the dll project's Properties window. YourForm is the name of your form.

This would display the form that was launched previously when the application started, so normally everything should flow as it did before from there.
0
 

Author Comment

by:vcharles
ID: 40601551
Hi,

Thanks for the instructions, I am able to access the Form, but receiving  error message  :Object regerence not set to an instance of an object", trying  to identify what is causing this error.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:vcharles
ID: 40601739
Hi,

I can't  access my data files  using  applucation.Startpath when using  the dll.

Victor
0
 
LVL 40
ID: 40601912
I just tested here and have not problem (with Application.StartupPath)

Are you sure that the files are distributed with the application?

What is the exception that you receive.

Can you show us your code?
0
 

Author Comment

by:vcharles
ID: 40602353
Hi,

I am using the code below to access a PDF  in a button click event:

Process.Start(Application.StartupPath & "\Search_Manual.pdf")

and the code below in the FormLoad event to use LinkFinal.xml in a dataset

  Dim curfile As String = (Application.StartupPath + "\linkFinal.xml")
            fslinkBEL = New System.IO.FileStream(Application.StartupPath + "\linkFinal.xml", IO.FileMode.Open)
            dtsetlinkBEL.Clear()
            dtsetlinkBEL.ReadXml(fslinkBEL)
            fslinkBEL.Close()  
          Dim sec As New Security
            For t As Integer = 0 To dtsetlinkBEL.Tables.Count - 1
                For i As Integer = 0 To dtsetlinkBEL.Tables(t).Rows.Count - 1
                    For j As Integer = 0 To dtsetlinkBEL.Tables(t).Columns.Count - 1
                        dtsetlinkBEL.Tables(t).Rows(i).Item(j) = sec.psDecrypt(dtsetlinkBEL.Tables(t).Rows(i).Item(j))
                    Next

                Next
            Next

I receive the same errors for both code eventhough both LinkFinal and Search_Manual.pdf fare included in the project.

Victor
0
 

Author Comment

by:vcharles
ID: 40602412
Hi again,

The properties of both files are set to content, is this the correct setting?

Victor
0
 
LVL 40
ID: 40602436
Looks OK, but what is the error you get?

Content usually does the job by default for external files, but you can verify.

Check under the Application Files of the Publish tab that you use to set up your deployment. Make sure that your files are there, marked as Include and Required.

If so, then look into the installation directory to see if the files are there. That directory has a random name that changes with each deployment, so simply add a MessageBox that shows the Application.StartupPath, redeploy and run the application for the MessageBox to show you the name of the directory. Verify that your files are in there.
0
 

Author Comment

by:vcharles
ID: 40602801
Hi, the error is can mot find the xml oe pdf fike.
0
 

Author Comment

by:vcharles
ID: 40602846
I was using the regular setup method and including the xml and pdf files in the dll project, will publish the main  application when i get to the office snd get. back  to you.  Error message  is can not find file in application's  folder.

Thanks,

Victor
0
 
LVL 40
ID: 40603260
A ClickOnce installation is based on the application. There is no Publish tab for a dll project. So the files have to be in the Application project and marked as Content for the application, not the dll project. Otherwise, they are not included in the application package.
0
 

Author Comment

by:vcharles
ID: 40604423
Hi,

Got it.

Thank You.

Victor
0
 
LVL 40
ID: 40604530
This Visual Studio / .NET framework is so powerful. But there are so many little details to know before you feel at ease in that monster.

Glad I could help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

11 Experts available now in Live!

Get 1:1 Help Now