0

I know that this topic has been asked several times before but none of them seems to be the solution to my problem. I need to create a windows form application(in visual studio 2005, 32 bit) which I need to build with a makefile. I simply start with creating a windows form application and then changing the "properties->General->Configuration Type" to "Makefile". Then I add a simple makefile which practically does nothing. The problem is when I do that designer doesn't work anymore. The contents of the files are:

form1.h:

#pragma once
namespace design {
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
        }
    protected:
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private:
        System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
        void InitializeComponent(void)
        {
            this->components = gcnew System::ComponentModel::Container();
            this->Size = System::Drawing::Size(300,300);
            this->Text = L"Form1";
            this->Padding = System::Windows::Forms::Padding(0);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        }
#pragma endregion
    };
}

main file (design.cpp):

// design.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
using namespace design;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
    // Enabling Windows XP visual effects before any controls are created
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false); 
    // Create the main window and run it
    Application::Run(gcnew Form1());
    return 0;
}

make file (design.mak):

all: clean 
clean:
    @echo Clean
    if exist *.obj erase *.obj
    @echo Clean done!

project file(design.vcproj):

<?xml version="1.0" encoding="windows-1254"?>
<VisualStudioProject
    ProjectType="Visual C++"
    Version="8,00"
    Name="design"
    ProjectGUID="{2652A3E3-D3B2-48F0-8C9C-831BF4912839}"
    RootNamespace="design"
    Keyword="MakeFileProj"
    >
    <Platforms>
        <Platform
            Name="Win32"
        />
    </Platforms>
    <ToolFiles>
    </ToolFiles>
    <Configurations>
        <Configuration
            Name="Debug|Win32"
            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
            IntermediateDirectory="$(ConfigurationName)"
            ConfigurationType="0"
            CharacterSet="1"
            ManagedExtensions="2"
            >
            <Tool
                Name="VCNMakeTool"
                BuildCommandLine=""
                ReBuildCommandLine=""
                CleanCommandLine=""
                Output=""
                PreprocessorDefinitions=""
                IncludeSearchPath=""
                ForcedIncludes=""
                AssemblySearchPath=""
                ForcedUsingAssemblies=""
                CompileAsManaged=""
            />
        </Configuration>
        <Configuration
            Name="Release|Win32"
            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
            IntermediateDirectory="$(ConfigurationName)"
            ConfigurationType="1"
            CharacterSet="1"
            ManagedExtensions="2"
            WholeProgramOptimization="1"
            >
            <Tool
                Name="VCPreBuildEventTool"
            />
            <Tool
                Name="VCCustomBuildTool"
            />
            <Tool
                Name="VCXMLDataGeneratorTool"
            />
            <Tool
                Name="VCWebServiceProxyGeneratorTool"
            />
            <Tool
                Name="VCMIDLTool"
            />
            <Tool
                Name="VCCLCompilerTool"
                PreprocessorDefinitions="WIN32;NDEBUG"
                RuntimeLibrary="2"
                UsePrecompiledHeader="2"
                WarningLevel="3"
                DebugInformationFormat="3"
            />
            <Tool
                Name="VCManagedResourceCompilerTool"
            />
            <Tool
                Name="VCResourceCompilerTool"
            />
            <Tool
                Name="VCPreLinkEventTool"
            />
            <Tool
                Name="VCLinkerTool"
                AdditionalDependencies="$(NoInherit)"
                LinkIncremental="1"
                GenerateDebugInformation="true"
                SubSystem="2"
                EntryPointSymbol="main"
                TargetMachine="1"
            />
            <Tool
                Name="VCALinkTool"
            />
            <Tool
                Name="VCManifestTool"
            />
            <Tool
                Name="VCXDCMakeTool"
            />
            <Tool
                Name="VCBscMakeTool"
            />
            <Tool
                Name="VCFxCopTool"
            />
            <Tool
                Name="VCAppVerifierTool"
            />
            <Tool
                Name="VCWebDeploymentTool"
            />
            <Tool
                Name="VCPostBuildEventTool"
            />
        </Configuration>
    </Configurations>
    <References>
        <AssemblyReference
            RelativePath="System.dll"
            AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
        />
        <AssemblyReference
            RelativePath="System.Data.dll"
            AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
        />
        <AssemblyReference
            RelativePath="System.Drawing.dll"
            AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
        />
        <AssemblyReference
            RelativePath="System.Windows.Forms.dll"
            AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
        />
        <AssemblyReference
            RelativePath="System.XML.dll"
            AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
        />
    </References>
    <Files>
        <Filter
            Name="Source Files"
            Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
            UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
            >
            <File
                RelativePath=".\AssemblyInfo.cpp"
                >
            </File>
            <File
                RelativePath=".\design.cpp"
                >
            </File>
            <File
                RelativePath=".\stdafx.cpp"
                >
                <FileConfiguration
                    Name="Release|Win32"
                    >
                    <Tool
                        Name="VCCLCompilerTool"
                        UsePrecompiledHeader="1"
                    />
                </FileConfiguration>
            </File>
        </Filter>
        <Filter
            Name="Header Files"
            Filter="h;hpp;hxx;hm;inl;inc;xsd"
            UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
            >
            <File
                RelativePath=".\Form1.h"
                FileType="3"
                >
                <File
                    RelativePath=".\Form1.resX"
                    SubType="Designer"
                    >
                </File>
            </File>
            <File
                RelativePath=".\resource.h"
                >
            </File>
            <File
                RelativePath=".\stdafx.h"
                >
            </File>
        </Filter>
        <Filter
            Name="Resource Files"
            Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
            UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
            >
            <File
                RelativePath=".\app.ico"
                >
            </File>
            <File
                RelativePath=".\app.rc"
                >
            </File>
        </Filter>
        <Filter
            Name="Make Files"
            >
            <File
                RelativePath=".\design.mak"
                >
            </File>
        </Filter>
        <File
            RelativePath=".\ReadMe.txt"
            >
        </File>
    </Files>
    <Globals>
    </Globals>
</VisualStudioProject>

solution file (design.sln):

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "design", "design.vcproj", "{2652A3E3-D3B2-48F0-8C9C-831BF4912839}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Win32 = Debug|Win32
        Release|Win32 = Release|Win32
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {2652A3E3-D3B2-48F0-8C9C-831BF4912839}.Debug|Win32.ActiveCfg = Debug|Win32
        {2652A3E3-D3B2-48F0-8C9C-831BF4912839}.Debug|Win32.Build.0 = Debug|Win32
        {2652A3E3-D3B2-48F0-8C9C-831BF4912839}.Release|Win32.ActiveCfg = Release|Win32
        {2652A3E3-D3B2-48F0-8C9C-831BF4912839}.Release|Win32.Build.0 = Release|Win32
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

I know the makefile doesn't do anything(it also doesn't work with a reasonable makefile), but I don't care the build operation in this case. The only change that I make is changing the "configuration type" property and changing the "Keyword" property in the .vcproj file to Keyword="MakeFileProj". (Build doesn't work otherwise ?!). I'm really stuck in here, looking for any helpful idea.

Thanks,

Seleciii44

Lain
  • 2,166
  • 4
  • 23
  • 47
seleciii44
  • 1,529
  • 3
  • 13
  • 26

2 Answers2

0

You don't need to convert the project to Makefile type. Any Visual Studio project can be built from the command line from batch file or makefile. See this reference: http://msdn.microsoft.com/en-us/library/xee0c8y7%28v=vs.80%29.aspx

You need to use /Build switch. Examples:

devenv foo.csproj /Build "Release"
devenv foo.vcproj /Build "Debug"
Alex F
  • 42,307
  • 41
  • 144
  • 212
  • hi Alex, thank you for your response, i know that devenv is useful, but i'm stuck with makefile. – seleciii44 Aug 30 '12 at 15:09
  • You can use the devenv call as part of makefile. This is exactly the purpose of devenv command line switches - to use Visual Studio projects as part of a batch build, without any change in the project itself. – Alex F Sep 01 '12 at 06:05
  • i know that too :) The source codes are generated in a code generation tool and also the project file is generated with the tool. This is the part i need to keep that way. Anyway, i got everything working until now, but the only problem left is the design view. Also what you are telling is not a solution it's just a whole another way to do it, it's more feasible to solve the problem and continue with current solution. Because i can't afford a new integration process with the code generation tool. thanks again. – seleciii44 Sep 03 '12 at 05:12
  • i tried use make with "devenv foo.csproj /Build "Release". but the designer wouldn't work for the neither. It makes sense because it starts right after changing the "configuration type" to "Makefile". So, it means that the problem is not nmake it is the visual studio itself or something i'm missing. – seleciii44 Sep 03 '12 at 06:49
  • use devenv foo.csproj /Build "Release without converting the project to Makefile type. This is what I am trying to explain - work with original WinForms project, not with makefile project. – Alex F Sep 03 '12 at 10:46
  • ok i got your point. thanks for your patience :) As i said, doing it as you said will cost me a really big time. Also as i said again, what you'r saying is not a solution its an another way to do it. After going through that pain to integrate with makefile version, i still think there is a very damn and little but an exact solution to this problem. I will wait a little bit more for an another answer. Thanks again. – seleciii44 Sep 03 '12 at 18:49
0

Finally found the solution. The problem was in the "properties->NMake->IntelliSense->Common Language Runtime Support" option. I changed it from "No Common Language Runtime Support" to "Common Language Runtime Support" and it works now.

seleciii44
  • 1,529
  • 3
  • 13
  • 26