| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2292 人关注过本帖
标题:C#如何保存工程文件架构的?
只看楼主 加入收藏
dragon_xml
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2009-9-2
结帖率:22.22%
收藏
已结贴  问题点数:20 回复次数:4 
C#如何保存工程文件架构的?
问:C#如何保存工程文件架构的?点击.sln或.csproj文件怎么会运行程序的,XML文件是如何与程序相关联的?
有什么方法可以解决?
搜索更多相关主题的帖子: 架构 工程 文件 保存 
2009-09-02 14:46
swc
Rank: 3Rank: 3
等 级:论坛游民
威 望:6
帖 子:394
专家分:83
注 册:2006-4-7
收藏
得分:14 
用记事本打开sln文件,就可以看到里面包含的信息.VS2005应该就是通过读取这些信息来运行工程文件的.
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TRY", "TRY\TRY.csproj", "{DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

实践、学习、再实践、再学习......
2009-09-02 16:43
dragon_xml
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2009-9-2
收藏
得分:0 
谢谢这位兄弟的答复!但这个xml文件怎么才能读取信息来运行工程文件呢?我有点不太懂里面的过程?您能说得详细些么?
2009-09-02 17:26
swc
Rank: 3Rank: 3
等 级:论坛游民
威 望:6
帖 子:394
专家分:83
注 册:2006-4-7
收藏
得分:0 
sln文件基本上只是介绍性文件,包含一些工程的属性。其中
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TRY", "TRY\TRY.csproj", "{DC11C4A3-BEE4-4E04-87E4-AAA5617F38BB}"
这个语句将具体的内容指向了.csproj,这就有了进一步的工程信息。以下是csproj的信息。再讲具体我就不懂了。以前做过一个工程软件,涉及到了一些类似的概念,个人以为这些工程文件其实就是保存工程的一些属性及文件指向。至于具体有些什么内容,就需要对工程的要求进行提取、抽象、封装了。比如要放在.csproj里,还是放在.sln里。

下面是.csproj里的内容:

<Project DefaultTargets="Build" xmlns="http://schemas.
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{6C6E6736-5891-4018-AD5C-37F08C942528}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>VehicleManageSystem</RootNamespace>
    <AssemblyName>VehicleManageSystem</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Login.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Login.Designer.cs">
      <DependentUpon>Login.cs</DependentUpon>
    </Compile>
    <Compile Include="MainForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="MainForm.Designer.cs">
      <DependentUpon>MainForm.cs</DependentUpon>
    </Compile>
    <Compile Include="Option.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Option.Designer.cs">
      <DependentUpon>Option.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="Login.resx">
      <SubType>Designer</SubType>
      <DependentUpon>Login.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="MainForm.resx">
      <SubType>Designer</SubType>
      <DependentUpon>MainForm.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Option.resx">
      <SubType>Designer</SubType>
      <DependentUpon>Option.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
       Other similar extension points exist, see
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

实践、学习、再实践、再学习......
2009-09-14 09:13
dragon_xml
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2009-9-2
收藏
得分:0 
非常感谢!
2009-09-18 12:28
快速回复:C#如何保存工程文件架构的?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014887 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved