Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

14.09.2005, 01:12

Version / Build Control / Increment für Visual Studio VS2003

In einem Visual Studio 2003 Projekt gibt es eine Version Resource, in der ich bei jedem Build die Versionsnumme rautomatisch erhöhen möchte.

Gibt es dazu bereits ein script oder Add-In?

Patrick

Alter Hase

Beiträge: 1 264

Wohnort: Düren

Beruf: Fachinformatiker für Anwendungsentwicklung

  • Private Nachricht senden

2

14.09.2005, 01:15

Interessanter Weise interessierst Du Dich für Dinge die Dich bei Deinem jetzigen Wissensstand noch nicht zu interessieren haben - Begründung?

www.volkard.de << Tutorial durcharbeiten und Basics lernen.

David Scherfgen

Administrator

Beiträge: 10 382

Wohnort: Hildesheim

Beruf: Wissenschaftlicher Mitarbeiter

  • Private Nachricht senden

3

14.09.2005, 08:55

Google hilft...
http://www.dhlee.info/knowledge_base/19.html

4

15.09.2005, 02:07

Der Version Control ist als VB Script implementiert.

Das Projekt benötigt eine Resource mit einer VersionControl.
In der Beispiel.rc sind Variablen an folgender Stelle zu editieren.

Beispiel.rc

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Microsoft Visual C++ generated resource script.

//

#include "resource.h"
#include "VersionNo.h"  //  <----- hier ist eine Änderung

.
.
.
/////////////////////////////////////////////////////////////////////////////

//

// Version

//


VS_VERSION_INFO VERSIONINFO
 FILEVERSION FILEVER // <--- 1,0,0,0 durch FILEVER ersetzen

 PRODUCTVERSION PRODUCTVER  // <--- 1,0,0,0 durch PRODUCTVER ersetzen

 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040704b0"
        BEGIN
            VALUE "FileDescription", "Your App Application"
            VALUE "FileVersion", STRFILEVER                     // <--- 1,0,0,0 durch STRFILEVER ersetzen

            VALUE "InternalName", "Your App"
            VALUE "LegalCopyright", "Copyright (C) 2005"
            VALUE "OriginalFilename", "Your App.exe"
            VALUE "ProductName", " Your AppApplication"
            VALUE "ProductVersion", STRPRODUCTVER     // <--- 1,0,0,0 durch STRPRODUCTVER ersetzen

        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x407, 1200
    END
END

#endif    // German (Germany) resources

/////////////////////////////////////////////////////////////////////////////


Im Projektverzeichnis YourVS_Proj/YourApp/YourApp ist eine Datei namens VersionNo.h einzufügen in der folgende defines stehen müssen.

VersionNo.h

C-/C++-Quelltext

1
2
3
4
5
#define FILEVER          1, 0, 0, 3
#define PRODUCTVER       1, 0, 0, 3
#define STRFILEVER       "1, 0, 0, 3\0"
#define STRPRODUCTVER    "1, 0, 0, 3\0"
                    //<-- Blank Line



In der Visual Studio IDE dann Tool->Macros->Macros IDE die Script IDE aufrufen und unter
Project Explorer->MyMacros->Enviroment Events
das VersionIncrement Script einfügen

VersionIncrement Script

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Option Strict Off
Option Explicit Off
Imports EnvDTE
Imports System.Diagnostics

Public Module EnvironmentEvents

#Region "Automatically generated code, do not modify"
'Automatically generated code, do not modify
'Event Sources Begin
    <System.ContextStaticAttribute()> Public WithEvents DTEEvents As EnvDTE.DTEEvents
    <System.ContextStaticAttribute()> Public WithEvents DocumentEvents As EnvDTE.DocumentEvents
    <System.ContextStaticAttribute()> Public WithEvents WindowEvents As EnvDTE.WindowEvents
    <System.ContextStaticAttribute()> Public WithEvents TaskListEvents As EnvDTE.TaskListEvents
    <System.ContextStaticAttribute()> Public WithEvents FindEvents As EnvDTE.FindEvents
    <System.ContextStaticAttribute()> Public WithEvents OutputWindowEvents As EnvDTE.OutputWindowEvents
    <System.ContextStaticAttribute()> Public WithEvents SelectionEvents As EnvDTE.SelectionEvents
    <System.ContextStaticAttribute()> Public WithEvents BuildEvents As EnvDTE.BuildEvents
    <System.ContextStaticAttribute()> Public WithEvents SolutionEvents As EnvDTE.SolutionEvents
    <System.ContextStaticAttribute()> Public WithEvents SolutionItemsEvents As EnvDTE.ProjectItemsEvents
    <System.ContextStaticAttribute()> Public WithEvents MiscFilesEvents As EnvDTE.ProjectItemsEvents
    <System.ContextStaticAttribute()> Public WithEvents DebuggerEvents As EnvDTE.DebuggerEvents
'Event Sources End
'End of automatically generated code
#End Region

    Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
        '       If numError <> 0 Then
        '      Exit Sub
        '     End If
        Dim projs As System.Array
        Dim proj As Project
        Dim fileNumber, i
        Dim TextLine
        Dim SubStr

        projs = DTE.ActiveSolutionProjects()
        If projs.Length > 0 Then
            proj = CType(projs.GetValue(0), EnvDTE.Project)
            Dim full_path
            full_path = GetProjectDir(proj.FullName)
            full_path = full_path & "versionno.h"

            fileNumber = FreeFile()
            FileOpen(fileNumber, full_path, OpenMode.Input)
            TextLine = LineInput(fileNumber)
            FileClose(fileNumber)

            SubStr = Right(TextLine, 10)
            Dim Conv = SubStr(0) & SubStr(3) & SubStr(6) & SubStr(9)
            i = CLng(Conv) + 1


            Dim FormNumber
            If i > 9999 Then
                FormNumber = "0, 0, 0, 0"
            Else

                Dim Number = CStr(i)
                FormNumber = Number(0) & ", " & Number(1) & ", " & Number(2) & ", " & Number(3)
            End If

            Dim Textend = "\0"""
            Dim Text = """"
            Dim TextOut1 = "#define FILEVER          " & FormNumber
            Dim TextOut2 = "#define PRODUCTVER       " & FormNumber
            Dim TextOut3 = "#define STRFILEVER       " & Text & FormNumber & Textend
            Dim TextOut4 = "#define STRPRODUCTVER    " & Text & FormNumber & Textend

            '          Kill(full_path)

            fileNumber = FreeFile()
            FileOpen(fileNumber, full_path, OpenMode.Output)
            PrintLine(fileNumber, TextOut1)
            PrintLine(fileNumber, TextOut2)
            PrintLine(fileNumber, TextOut3)
            PrintLine(fileNumber, TextOut4)
            PrintLine(fileNumber, " ")
            FileClose(fileNumber)

        End If


       
    End Sub
    Function GetProjectDir(ByVal FullName)


        Dim proj_path
        proj_path = Split(StrReverse(FullName), "\", -1, 1)
        Dim count
        count = UBound(proj_path)
        Dim full_path
        full_path = ""
        Dim i
        For i = 1 To count
            full_path = full_path & "\" & proj_path(i)
        Next
        GetProjectDir = StrReverse(full_path)
    End Function
End Module


Erweiterungen bitte an diesen Thread fügen.

Werbeanzeige