Wednesday, December 12, 2012

Automatically Increment Version number for Assembly

I have to look this up every time I do it, so I am posting this link to make it easier to find.


http://www.csharpcity.com/2012/visual-studio-automatic-version-numbering/



To summarize, you have to change the C# assemblyinfo.cs file from:

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


to just:

[assembly: AssemblyVersion("1.0.*")]
 
 
The AssemblyFileVersion entry must not be present. 
 
The version only increments when the project is opened, so it may appear that the version does not increment.
 
 
For VB.NET it is similar.   Edit the assemblyInfo.vb file and change:
 
 
 
 
 
to:
 
  


The GUI for Assembly Version does not let you make this change.

Tuesday, November 27, 2012

Closing Parent Form from Child Form in VB.NET

The Application.Exit() call can be made in the child form's FormClosed event to exist the app when the child form is closed.


    Private Sub Form_Child_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        Application.Exit()

    End Sub

Unload Event equivalent in VB.NET



For VB.NET, you can use the FormClosed or FormClosing in place of the VB6 Unload event.

Tuesday, April 3, 2012

Can't find Mime Types in IIS 7.5

I was installing a Web Application on IIS 7.5. Everything seems to work until I try to visit some of my pages and they just didn't do anything, no error messages or anything. Strangely, all of the .aspx files worked, it was just simple files like .htm and .jpb that didn't work.

I thought maybe the Mime types were not setup correctly, so I went to see what was defined. I couldn't find the Mime Types option in the IIS Managment Console.

It turns out that the Static Content option under the Http Features (under Server Managers, Web Server roles) was not installed. Installed the Static Content option in Server Manager and everything started working.