我知道這個話題以前曾經被問過幾次,但沒有一個似乎是我的問題的解決方案。我需要創建一個Windows窗體應用程序(在Visual Studio 2005中,32位),我需要用一個生成文件構建。我只是從創建一個Windows窗體應用程序開始,然後將「properties-> General-> Configuration Type」更改爲「Makefile」。然後我添加一個簡單的makefile,它實際上什麼都不做。問題是,當我這樣做,設計師不再工作。這些文件的內容是:vs2005 - vC++ - 設計器無法顯示此文件,因爲其中沒有任何類可以設計
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
};
}
主文件(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文件(design.mak):
all: clean
clean:
@echo Clean
if exist *.obj erase *.obj
@echo Clean done!
項目文件(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>
解決方案文件(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
我知道文件也不做任何事情(它也不會與合理的makefile工作),但我不關心構建操作在這種情況下。我做的唯一更改是更改「配置類型」屬性,並將.vcproj文件中的「Keyword」屬性更改爲Keyword =「MakeFileProj」。 (構建不起作用?!)。我真的被困在這裏,尋找任何有用的想法。
感謝,
Seleciii44
嗨亞歷克斯, 感謝您的迴應,我知道devenv是有用的,但我堅持與makefile。 – seleciii44
您可以將devenv調用作爲makefile的一部分。這正是devenv命令行開關的目的 - 使用Visual Studio項目作爲批量構建的一部分,而無需對項目本身進行任何更改。 –
我也知道:)源代碼是在代碼生成工具中生成的,並且該工具文件也是使用該工具生成的。這是我需要保持這種方式的部分。無論如何,我得到了一切工作到現在,但剩下的唯一問題是設計視圖。此外,您所說的並不是一個解決方案,它只是完成另一種方式的解決方案,解決問題並繼續使用當前解決方案更爲可行。因爲我無法負擔使用代碼生成工具的新集成過程。再次感謝。 – seleciii44