System.AppDomain.CurrentDomain.BaseDirectory : Save Files To It From Outside The Application?

Jan 22, 2010

I published my VB 2008 Express application and installed it on a test computer. The test computer has .NET 3.5 on it, but does not have any Visual Studio development programs on it (I think this is the best way to really test it before sending it to other users. It works fine.The application reads some data from a text file. Every few days, I need to update this text file and send it to the user. (I do not want to republish everything, and I do not want to run a web server.) I naively (??) designed things so that this would be done by attaching the new text file to an email and sending it to the user. The user would simply (?) save this attachment to the same directory as the .exe was in (the application directory). In the old days, there would have been an .exe file in some folder like c:Program FilesDavewareMyprog.exe. And my .txt file would be right beside it.In the code, I have used

System.AppDomain.CurrentDomain.BaseDirectory() & "MyDataFile.txt"

in various places where I use a Streamreader and Streamwriter to access it. But I've now sent an 'update' email with the .txt file to the test computer, and proceeded to save the attachment, and then realized I'm stuck. I can't find any directory that looks like it might be a good old application folder. In fact, there are references to my application all over the place, in very ugly looking paths.Now I think I'm in trouble as I read the MSDN on BaseDirectory, which starts out:"Gets the base directory that the assembly resolver uses to probe for assemblies".Is there any way I can do things as I designed it? I can think of some work arounds, like try to hard code some folder off c: that has nothing to do with where the .exe is etc, but putting it in the 'application folder' seems so much easier and wouldn't require knowledge of which drive the .exe ended up on etc. on the user's computer.

View 2 Replies


ADVERTISEMENT

C# :: Handle Exceptions In AppDomain.CurrentDomain.UnhandledException?

Dec 28, 2009

Is it possible to handle exceptions on the AppDomain.CurrentDomain.UnhandledException callback? I want to do the following:Show my own "an exception hasoccured" dialog, with a "Send Report"button After the user dismissed thebox, I want to close my app, but I donot want to Windows default crash dialog "Theapplication needs to close" box toshow up.

View 2 Replies

Save Image Files To HD Path From A RESTful Api With Out Using Imports System?

Mar 13, 2011

I am currently trying to create a DLL for use with a RESTful api. The only issue I have is that so that this DLL can be used in a service or a program without a GUI, so I can't use "Imports System.Drawing.Imaging" as this requires a form. I have looked around for examples to handle this without using this library but have had no luck.

[Code]...

View 4 Replies

Save Text Files To Application Directory?

Mar 20, 2012

This is a new question based on the response from an older post. I needed to save a value when my app is run for the first time that would be applicable to all users who logon to the PC and use my application. The setting is only known at the time of the install so Application settings with application or user scope are unsuitable. I was advised to save the setting to an external file and save/read it as needed. The obvious choice was to save the file to the projects application path (keeping things tidy). Everything worked fine during testing but when the application is installed on a PC, the application path becomes C:program files application nameetc. When I try to execute the code that saves the file, I get a permissions denied error. I understand that it's part of the UAC control but when did it become acceptable to stop developers programmatically creating files in their own application folder?

View 16 Replies

VS 2010 Application Supports The Creation Of System Files From A Windows Mobile PC - Subject?

Jan 28, 2010

I would like to fine-tune their work tool.The basic idea is to load different libraries etc CppThere in my working environment, such as files - *. dsm.Read the information from them is no mean feat.

View 2 Replies

Save File Extensions - Save/open Dialog Wont Show .GDL Files Unless Select "all Files"?

Mar 22, 2011

im used to C programming.

Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click
timedate.Stop()[code]......

The problem is that if I save a file I get "myfile.GDL" if I overwrite that I get a new file "myfile.GDL.GDL" ect.the other problem being that the filtering in the windows save/open dialog wont show .GDL files unless I select "all files".

View 6 Replies

Application.Settings VB 2005 - Save Arrays Using The Settings System Object

Jan 14, 2009

I just wondered if you can or can't save arrays using the settings system object. There seems to be no way of entering it at designtime. It seems implied you cannot create new user settings.subobjects at runtime. I'm looking to find the easiest way to save a populated array of PictureBox's. If the only way is a self/custom made/managed .ini file then I need to know so i can start on that but I was hoping to use some of all this phaff in the new frameworks usefully.

View 3 Replies

.net - The System.Linq.Dynamic Namespace - Visual Studio Does Not Recognize In The Project Files The System.XXX References

Aug 11, 2011

I would use the System.Linq.Dynamic. I added the specified Dynamic.vb file, that starts like this:

[Code]...

to my (VB.NET)solution. Now Visual Studio does not recognize anymore in the project files the System.XXX references, proposing me to change them to Global.System.XXX

View 1 Replies

Save Multiple Text Files Using A Save Dialog?

May 2, 2009

I am trying to save multiple text files using a save dialog.

I can save one textbox

SaveFileDialog1.ShowDialog()
Dim File As System.IO.File
Dim Write As System.IO.StreamWriter
Write = File.CreateText(SaveFileDialog1.FileName)
Write.WriteLine(TextBox1.Text)
Write.Close()

but I don't know how to save multiple textboxes and richtext boxes. Would I have to use a screenwriter for this?

View 7 Replies

Accessing Files Off Of A Drive That Has A Different Path From System To System?

Mar 26, 2011

I'm coding this neat little project that's kind of a hack into the SanDisk U3 Cruzer's ability to have both a CDFS and FAT32 File System. This is helpful because the program is burned to the CDFS (It's basically slip streamed as an .ISO in place of the original U3 .ISO), and the settings files (which I've developed as text files) are placed on the root of the flash drive. The program itself is VERY simple actually, except I'm having a slight issue that's really driving me insane:

The drive path of the Flash Drive won't be the same from computer to computer. I.E... The files are "UAI.txt" and "UInfo.txt". The root of the drive on my comp is "I:", but on my laptop is "F:". So if I program the path from my computer as the absolute path, an exception is thrown when the path changes on another computer. I cannot have this happen. It is probably THE MOST crucial element to this program. How can you save and read info if you can't find the files? =P

So I've gone through so many threads and forums trying to find a batch of code to allow me to make the path relative. I've found the following code (modified, of course). It works PERFECT in Debug, but throws an exception once packaged to the CDFS partition:

[Code]...

View 3 Replies

Write - Save - Read .txt Files (or Html Files)

Mar 14, 2011

I want to develop an application which can Write, Save, Read text files(or html files) What I want the application to do is. When I open my application I can write stuffs and then it will save it to my hosting/server. Then, the application will read the text which I already save.. So far, I can only make the application read it by using WebBrowser control and navigating it to a specified URL. Example: [URL](or message.txt) Which I modified from the website not from the application. I want to modify the text or html files from my application.

View 6 Replies

How The Required System Files And Dll Files Shall Be Included Into Setup.exe

Jul 31, 2010

if I use a third party distribution application like Setup2Go etc. to make my setup files, will my application run properly on user's computer?I mean how the required system files and dll files shall be included into my setup.exe?Does user need anything install, prior to my application's installation?

View 3 Replies

VS 2008 How To Differentiate System Files From Other Files

Apr 26, 2012

Dim fc = My.Computer.FileSystem.GetFiles(Destination).Countto get the no of files from the directory D:Images9 (Destination=”D:Images9”). It returns the count including the system files present in that directory ex: Thumbs.db How can I avoid thihow to find (search) a particular file in the specified directory.

View 1 Replies

Find AppDomain By Name?

May 11, 2011

have created a new AppDomain with a unique name. But i do not want to store that name during the whole application runtime.So i ask you guys if it is possible to get that created AppDomain by name back.

Sub Main()
AppDomain.CreateDomain("TestDomain")
End Sub

so How do i get the AppDomain with the name "TestDomain" back so i can unload it later without storing that AppDomain globally?

View 9 Replies

What Is AppDomain.CreateDomain

Jan 19, 2010

What is AppDomain.CreateDomain

View 2 Replies

VS 2005 - Login System - Application Which Has User Authentication System

Apr 1, 2009

I'm writing an application which has user authentication system, basically, when the user open the software, he has to enter his/hers username and password which are retrieved form a access data base, and if the user is set as admin then it enable some features, I couldn't figure out how to read the column lets say, IsAdmin table, which will store an value of 1 or 0 for example. I need a concept of how build a login system with levels or whatever you guys call it...

View 2 Replies

Event Type Clr20r3 P3 4a5c12c0 System.net.sockets.socket Exception And Application Crash On Some System While Running Well On Others

Aug 3, 2009

Event type clr20r3 p3 4a5c12c0 system.net.sockets.socket Exception and Application crash on some system. while running well on others. i go thorugh many forms and search a lot on google but not able to resolve the issue.

[Code]...

View 1 Replies

.Net, AppDomain Unload Via An Interface?

Dec 2, 2010

I have an ApDomain that is running a Main Routine, for example:

Public Sub Main() Implements Interfaces.IScript.Main

For a as Integer=1 to 99999

[Code]...

View 3 Replies

Difference Between An AppDomain And A Process?

Apr 28, 2009

Can you have more than one AppDomain in a process Or more than one process in a AppDomain? What about threads? I was always told there were many threads in one process and one processor has many processes. How does App Domains fit into this picture?To me, it seems like its the same concept with a different name??

View 1 Replies

Load DLL In Separate AppDomain?

Jun 16, 2007

the forum,this is my first message, and I hope that my English is understandable (I'm Italian)....I've developed a WIndows Service using VB.net 2.0; this service executes a routine every 4 hours... I would like load a dll (without entry point) at run time and when the operation is terminated, I would like unload that. I think that I've to create a new AppDomain and to load my DLL into this, but I don't know the good way to do it.

View 9 Replies

File I/O And Registry :: Save File Dialog - Allow Users To Choose The Directory To Save Files Into

May 8, 2010

I am trying to find a way to allow my users to choose the directory to save files into, THe file name is automatically generated as it has a naming convention and i am able to pre program a location to save to but i d like to be able to allow my users to decide themselves which directory they want to save the files to and to have the ability to choose which directory to save to

[Code]...

View 2 Replies

.net - AppDomain Only Partially Respecting InitializeLifetimeService (if At All)?

Feb 23, 2012

First, I changed my ILS function to be simply: Public Overrides Function InitializeLifetimeService() As Object Return Nothing End Function

Then I included this in my Program as well as A. As Timiz0r pointed out, Form inherits MarshalByRefObject, so I didn't have to include a Inherits statement on my main class (which already inherited Form). This was the big thing, because I didn't include it originally. Next, I changed my AppDomain setup to be:

Dim _ADomain As AppDomain = AppDomain.CreateDomain(Name)
Dim item As New A
item = CType(_ADomain.CreateInstanceAndUnwrap(GetType(A).Assembly.FullName, GetType(A).FullName), A)

With these changes I can now use separate instances of the DLL COM object as desired.

Original Question I am writing an application that creates a list of objects, each referring to a DLL, and each object placed in its own AppDomain to keep the instances of the DLL from interfering with each other. Taken another way:Program maintains a List(Of A)A is created as an instance of AppDomain using CreateInstanceAndUnwrap Each A refers to mirror.dll, which is including in the application's references

[Code]...

View 1 Replies

AppDomain Instance Creation Error

Aug 16, 2010

I keep getting a "System.Runtime.Serialization.SerializationException" in my application while loading a not-defined assembly (AKA: Plug-in loading.)Even if I turn Serialization on for that plug-in, then it will fail once again. I've been looking around and couldn't find a good tutorial about it..

So all together: How to load an assembly using AppDomain?

View 10 Replies

AppDomain, WebBrowser Memory Leak?

Apr 23, 2011

I have done a lot of research on the memory leaks present in the WebBrowser control, and the following thread (http:url]...) told me that the only real way to reclaim the memory eaten up by WebBrowser is to load the control in a separate appdomain.I went ahead and did this, but when I unload the AppDomain that the WebbBrowser is created in (using AppDomain.Unload()), the memory is still not freed. I am looking at the Private Bytes of the process in Task Manager (which is accurate and what I'm interested in) to confirm this. The memory usage stays at 50MB+ instead of its default 5MB.Here is my code:

Form1.vb
Imports System.Reflection
Public Class Form1
Private ad_WBInst As AppDomain[code].....

View 6 Replies

AppDomain.Unload Does Not Free Up The Used Memory

Oct 23, 2011

I'm kinda new here, and I didn't know what forum to put this in, so I just put it here. I wanted to load an assembly to an Application Domain, use it, then unload it when I'm done with it. The assembly uses too much memory. The problem is: After I unloaded the assembly, the memory used is not getting freed. I was watching the performance all the time. The available memory increases only after I close the whole application. And that assembly is the only thing that uses a lot of memory in my application. Here's the code I used to load and unload the assembly: How can I free up the memory without closing my application. The memory was suppose to get freed up by simply unloading the assembly that uses it much.

View 2 Replies

Cross-AppDomain Singleton With Remoting ?

Mar 8, 2011

I have an Addin for MS Excel which needs a singleton to share data amongst modules.Depending on the version of Excel (2003, 2007, 2010), and how Excel was started, it calls my addin from different, unpredictable AppDomains, which prevents the classic singleton approach.Creating a custom AppDomainManager won't work because Excel has already created the AppDomains before the addin is called.

Linking to mscoree to enumerate domains breaks the addin registration process (and I really don't want that anyway); there doesn't seem to be any other way of enumerating, so that isn't an option either.The only solution that I've found is to use remoting. Here's my test rig:

Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
' Remeber to add reference to System.Runtime.Remoting DLL[code].....

Once everything is running, access to the singleton takes ~100µS, which is perfect. I can live with the ~400mS the first time each AppDomain is initialised. The problem is at startup, where the remoting invocation takes ~2.5 seconds.

View 1 Replies

Get The Information Of All The Appdomain Created In Given Process?

Sep 26, 2010

I need to get the information of all the appdomain created in given process?

View 4 Replies

Appdomain.unhandled Exception Event Is Not Always Executed

Jan 5, 2011

I have a service application that randomly stops without any errors in my log or in the event application log. I believe that there could be an unhandled exception somewhere in the code so I set up the AppDomain.Unhandled event to catch any exceptions. While trying to induce unhandled exceptions I have found that this event is not always fired. I added the following code to my service's Shared Sub Main method (but I orginally had it in the OnStart method and was seeing mostly the same thing)

Dim currentDomain as AppDomain = AppDomain.CurrentDomain
Add Handler currentDomain.UnhandledException, Address of MyHandler

View 7 Replies

Command Window Hiding When An .exe File Is Run Using An AppDomain

Nov 8, 2011

I have created an application domain, using which i am executing an .exe file.So the command window does open which has the title as file name. I want to hide the command window.

Dim newAppDomain As AppDomain = AppDomain.CreateDomain("", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation)
newAppDomain.ExecuteAssembly(IO.Path.Combine(Offic eAddInConfig.Instance.BinPath & "Core", "file1.exe"))

Here a command prompt will be opened which need to hide.

View 1 Replies

Stable Plugins Architecture Using An Appdomain Per Plugin?

Jun 22, 2010

how to create a stable plugin architecture. Stable because I plan on opening up plugin creation to the public but I dont want a sloppy coded plugin to take down my whole application.

So I thought of using an AppDomain per plugin and I did a little seaching. But it seems that even using a temp AppDomain to load plugins and then unloading it once all assemblies have been inspected raises complexity allot and I was planing on using an AppDomain per plugin.

I feel the gained stability (if there is any at all) may be raising the complexity so much the app will never be done..

Is there another way to both create a stable application and at the same time making it extensible?

I cases where the host calls a defined function via say IPluginInterface I guess I can pack a whole lot of try catch blocks around that call but what if a plugin insisted of a timed routine that would run continously without being invoked from the host other that a starting call to StartPluginService or something like that?

If I include a plugin like that in the default AppDomain and it blows up I sure will blow my own foot off right?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved