|
This info must be available in lots of places, but here it goes (in short)...
To publish the initial application:
1. Right click on the Project in solution explorer. Click Properties. Click the Publish tab.
2. Enter the location you want to publish to in 'Publishing location'
3. Click the 'Updates' button.
4. Check the 'Application should check for updates' checkbox.
5. Check the 'Before the application starts' radio button.
6. Click OK to close the dialog.
7. Back on the main screen, select 'The application is available offline as well'
8. Enter your initial publish version under 'Publish Version'
9. Click the 'Publish Now' button.
To publish an update:
If you want to publish an optional update, just increment the 'Publish Version' and click the 'Publish Now' button. When starting the application the user will be prompted if the update should be installed. The user has the option to skip the update.
If you want to publish a required update, increment the 'Publish Version'; then, click the 'Updates' button. In the dialog, check the 'Specify a minimum required version for...' checkbox. Enter the same version you just entered in 'Publish Version'. Click OK to close the
dialog. On the main screen, click the 'Publish Now' button. The update will automatically install as soon as the user starts the application.
Hope this helps,
Roel
|
|
|
|
|
Thnx alot Mr.Roel
I found ur help on click once is useful, but here i have a doubt about my current Error: INVALIDDEPLOYMENTEXEPTION, saying "Application in not installed"
Here i have taken a button[Update] and when user clicks the buttion the functionality should checks the updated version and if available it should download the latest version for that my code is,,
in Buttion
private void button1_Click(object sender, EventArgs e)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;
bool update = appDeploy.CheckForUpdate();
if (update)
{
UpdateCheckInfo updateInfo = appDeploy.CheckForDetailedUpdate();
string version = updateInfo.AvailableVersion.ToString();
bool updateRequired = updateInfo.IsUpdateRequired;
string minVersion = "";
if (updateInfo.MinimumRequiredVersion!=null)
minVersion = updateInfo.MinimumRequiredVersion.ToString();
bool updateAvail = updateInfo.UpdateAvailable;
long footprint = updateInfo.UpdateSizeBytes;
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Update Version: {0}\r\n", version);
sb.AppendFormat("Minimum Version: {0}\r\n", minVersion);
sb.AppendFormat("Update Required: {0}\r\n", updateRequired);
sb.AppendFormat("Update Available: {0}\r\n", updateAvail);
sb.AppendFormat("Update Footprint: {0} bytes\r\n", footprint);
MessageBox.Show(sb.ToString());
if (updateAvail)
{
bool updated = appDeploy.Update();
if (updated)
Application.Restart();
}
}
else
MessageBox.Show("No updates are available.");
}
else
{
MessageBox.Show("This application was not launched using ClickOnce. Cannot perform update.");
}
}
in PageLoad
private void Form1_Load(object sender, EventArgs e)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;
this.label1.Text = appDeploy.CurrentVersion.ToString();
appDeploy.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_CheckForUpdateProgressChanged);
appDeploy.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(appDeploy_CheckForUpdateCompleted);
appDeploy.UpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_UpdateProgressChanged);
appDeploy.UpdateCompleted += new AsyncCompletedEventHandler(appDeploy_UpdateCompleted);
}
}
void appDeploy_UpdateCompleted(object sender, AsyncCompletedEventArgs e)
{
string s = String.Format("UpdateCompleted canceled?{0}, sender: {1}", e.Cancelled, sender);
listBox1.Items.Add(s);
}
void appDeploy_UpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e)
{
string s = String.Format("UpdateProgressChanged {0}, sender: {1}", e.State, sender);
listBox1.Items.Add(s);
}
void appDeploy_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
{
string s = String.Format("CheckForUpdateCompleted {0}, sender: {1}", e.UpdateAvailable, sender);
listBox1.Items.Add(s);
}
void appDeploy_CheckForUpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e)
{
string s = String.Format("CheckForUpdateProgressChanged {0}, sender: {1}", e.State, sender);
listBox1.Items.Add(s);
}
}
Hope You got me,
please help me thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
In which line does this error occur?
Roel
|
|
|
|
|
Are you sure you selected 'The application is available offline as well' on the publish tab when you published it?
Roel
|
|
|
|
|
yes i am sure, i've selected 'The application is available offline as well'
and can u please help me , how to work with Deployment.[ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;]
i couldn't create instance to ApplicationDeployment ,
please tell me whatz all the credentials needed to create an instance to ApplicationDeployment .
thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
The ApplicationDeployment class does not have a constructor, so you can't create an instance of it. The only way to get an instance is to use the static CurrentDeployment property.
No offense, but I do suggest you start looking at the documentation rather than asking basic questions like this on the forum. The forum really is meant to get answers to things you can't readily figure out from the documentation.
The entire .NET framework documentation is available online. See for example:
http://msdn2.microsoft.com/en-us/library/system.deployment.application.applicationdeployment.currentdeployment.aspx[^]
Best regards,
Roel
|
|
|
|
|
|
I have to tables that I have joined together in sqlserver and I am trying to pull columns from both. However, myReader only picks up the first table's columns and i cannot retrieve any columns from the second table. How do I retrieve columns from multiple tables? Here's what I've got. Also is there just a way to type in the column names when retrieving data as opposed to specifying the column id. All suggestions welcome. thanks.
while (myReader.Read())
{
agencyname = myReader.GetString(13);
agencyaddress = myReader.GetString(4);
agencycity = myReader.GetString(26);
agencystate = myReader.GetString(15);
agencyzip = myReader.GetString(28);
agencyphone = myReader.GetString(22);
}
|
|
|
|
|
Yeah, it's possible to bring back the data by name but not the way you are doing it unfortunately. Not sure why MS do things this way but if you use:
agencyphone = myReader["YourFieldName"].ToString(); it should work (it's fine for strings but a pain for other datatypes)
I'm not sure why you only get one table's worth of fields back in the query, what does it do when run in query analyser /SQL Management Studio?
Depending on how many rows you have in each table and the width of the table it is often worth using DataRelations in a dataset to join on the client side, this can reduce the weight of data that you pull down the wire consderably.
Hope this helps,
Russell
|
|
|
|
|
Thanks Russell. By reference the columns by their names instead of their id's I was able to pull the column from the second table. You're a life save. Thanks, Again.
|
|
|
|
|
Hi,
I'm trying to get the parent of a MDI form with this code:
<br />
Coordinator c = (Coordinator) this.MdiParent;<br />
But, after the instruction, c is null (debugger);
Any tips?
Many thx,
Nuno
|
|
|
|
|
how about if you do MdiParentForm mdipf =(Mdiparentform) this.....
|
|
|
|
|
I have been working on a Windows forms application that lets you list active user sessions on a server/pc.
From there it will allow to :-
connect to a user using vnc/rdp/etc
Log off user
Shutdown PC
Restart PC
Kill remote running programs/processes
Connect to drive(s) of local machine
Connect to users home folder
List various WMI classes on the PC that user is connected to
I could list more.
But, I am trying to gauge how much interest there might be from others in helping out on an open source c# project that will utilize Windows Forms(using GridView/ListView heavily), WMI and Active directory. That will create a tool that can manage PCs/Users without the need to install local agents (although this may be added later).
I have written the code for all of the above functions already and I have lots of other functions/features to add.
It would be really great if there was any interest from someone in the community to help me develop this application further as an open source project.
So any interest/ideas?
|
|
|
|
|
This isn't really a good place to ask this question, since it's not a specific C# related programming question; maybe try under Collaboration, but I suggest either just creating a SourceForge.net project or put it up on CodePlex and go from there ...
You could always, after posting it to one of those two boards, come back and announce the project via your "CP Blog".
|
|
|
|
|
I have a class1 and in one of its methods I created a local instance of class2 passing to its ctor a member var of class1.
Within class2 I modified the parameter passed to its ctor. To my surprise when I returned to class1 its member var was also modified? C++ wouldve handled this as a local var within class2. What's going on here?
Tia.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
you are passing a reference to the object by value, not the object itself by value. This has often been a source of confusion as it appears at first that value types and reference types behave differently. If you used a struct instead i suspect you would see the behaviour you were expecting.
It's one of those things that is very hard to explain so i'm not going to try right now as I'll probably just confuse the issue. There are a couple of articles around the place if you google for something like 'c# reference pass type by value' or similar you should find a more eloquent description of what's happening than i could provide.
HTH
Russell
|
|
|
|
|
C# passes objects by reference, but the references themselves are passed by value.
Newbies find this very confusing. I know, 'cause I did.
Cheers,
Vikram.
The cold will freeze our stares
We won't care... Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
hi all,
i have a program that make a lot of graphical drawing so it consumes a very big space of memory (i think memory leak)
Is any one know how to find where is the leak comes from
(i means where is the unreachable code)
thanx
Generator
|
|
|
|
|
I always make sure to dispose of Graphics objects as they have a bad habit of causing leaks if not thrown away after use.
liberal sprinklings of the using keyword don't hurt either.
Russ
|
|
|
|
|
hi ,
i draw alot of rectangles(one at each invalidate at a moment )
i draw in OnPaint but in it i cannot make dispose (what can i do)
also where i can use GC.Collect
Generator
|
|
|
|
|
Hi,
if you create some objects (a Pen, Brush or any other instance of a class that has
a public Dispose() method) inside your OnPaint method, you MUST call Dispose for them.
Additionally, if you need the same object over and over (such as new Pen(myColor)) then
I suggest you create it only once and keep it in a class member (rather than continuously
creating and disposing and collecting them).
And finally, if the objects you need correspond to system objects (such as the ones
available in SystemPens, SystemBrushes,...) I suggest you use these (without new,
without Dispose !).
And I do not recommend you call GC.Collect at all (the gc works fine all by itself),
and certainly not from inside any OnPaint method ! (GC.Collect is expensive and
should not be called by the UI thread, it might ruin the responsiveness).
|
|
|
|
|
Hi,
from debug of my program i noticed that Update();
is making bad effect and may be the reason of memory leak
so can any one tell me what is the disadvantages of it
thanx
Generator
|
|
|
|
|
Hi,
if you mean Control.Update() I dont know why you think you need it. In all the programs
I have ever developed I never felt the need for it: correct program design (including
the use of background threads for longwinding tasks) results in good responsiveness
without problems.
On the other hand, Update does NOT cause memory leaks; only errors in your code
( or in .NET itself, rather unlikely) can do that, e.g. not calling Dispose().
If you want us to be able to help you, you should explain more about your app,
and publish the pieces of code you suspect yourself, rather than using
obscure observations (a very big space of memory, unreachable code, bad effect).
|
|
|
|
|
hi,
ok you are right i am making a packet that moved on a line
when i click a button and stopped when i click stop
so i use thread but the stop button be not responsive and the app hang up
so one here advice me to use BackgroundWorker so i use it but i have a very large consuming of memory when i click the first button i donot no why so i try to solve it hardly
so last i remove update then the memory consuming decreased but not every time i start my application run i work well
some times it work bad so i tried also
so to ask a question if i called a method for a thread or backgroundworker and in this method other method is called
the second method would be run by the program process or by this thread
if by program then i will correct my code
else
i will publish the pieces of code to see(i miss understanding)
thanx alot
Generator
|
|
|
|
|
Hi,
I did not understand very much of what you wrote.
It seems like you want some animation to start when a "Start" button is pressed,
and stopped when a "Stop" button is pressed, and furthermore the "Stop" button does
not (always) work reliably.
There can be several causes for this:
- you might be doing too much stuff in the UI thread
- CPU load might be high at or above the priority of the UI thread
- some logical error in the communication bewteen the "Stop" button handler,
and the thread that does the animation.
Maybe this info will help:
methods are executed on the same thread as the code that calls them (unless you
do very special things, such as calling Invoke). Some asynchronous stuff is executed
on another method automatically (e.g. a tick handler for all timers, except a
Windows.Forms.Timer).
if you try to modify the user interface (i.e. add/remove/modify a Control) from
a thread other than the UI thread (the one you have at start) then:
- under .NET 1.1 your program may freeze, or behave unpredictably
- under .NET 2.0/3.0 you will get some "CrossThread" Exception (you could set some
flag false to skip the checks, but then the app may freeze again).
You may want to create your own background thread, so you can fully control it
(set priority, kill/abort it, etc).
You may want to find and read an MSDN article entitled
"How to: Use a Background Thread to Search for Files "
which probably explains more on InvokeRequired, Invoke, threads, etc.
|
|
|
|
|