Colorful Life2010

在VS2005 环境下面使用.NET Framework 1.1 进行编译
Weather:晴 南风3-4级 (21~27)℃

能直接提供编译.NET framework 1.1的功能, 不能直接在VS2005下使用.NET framework 1.1 编译

幸运的是    MSBuild有强大的扩展性,可以使我们去找到一种办法去解决这个问题。

让我们来看看应该怎么做:

首先把下面这个XML 保存为C:\program files\msbuild\CrossCompile.CSharp.targets, 一定要是这个路径


 DefaultTargets="Build"  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

       true   full   false   bin\.NET 1.1\Debug\   DEBUG;TRACE   $(DefineConstants);TARGETTING_FX_1_1      4   false   $(SystemRoot)\Microsoft.NET\Framework\v1.1.4322   v1.0  

    pdbonly   true   bin\.NET 1.1\Release\   TRACE   $(DefineConstants);TARGETTING_FX_1_1      4   false   $(SystemRoot)\Microsoft.NET\Framework\v1.1.4322   v1.0  

  

       $(AvailablePlatforms),.NET 1.1

      {CandidateAssemblyFiles};    $(ReferencePath);    {HintPathFromItem};    {TargetFrameworkDirectory};    {AssemblyFolders};    $(OutputPath);    {GAC}   

      $(SystemRoot)\Microsoft.NET\Framework\v1.1.4322   

 

        false     

          Name="GetFrameworkPaths"         DependsOnTargets="$(GetFrameworkPathsDependsOn)">

       Condition=" '$(Platform)' != '.NET 1.1' ">           

       Condition=" '$(Platform)' != '.NET 1.1' ">           

 

       ResolveAssemblyReferences;BeforeResGen;CoreResGen_1_1;AfterResGen            Name="CoreResGen_1_1"         DependsOnTargets="$(CoreResGenDependsOn)">                  Condition = " '@(ResxWithNoCulture)' != ''"             Sources = "@(ResxWithNoCulture)"             UseSourcePath = "$(UseSourcePath)"             StateFile = "$(IntermediateOutputPath)$(MSBuildProjectFile).CrossCompileResGen.Cache"             OutputResources = "@(ManifestResourceWithNoCultureName->'$(IntermediateOutputPath)%(Identity).resources')"         >              

              Condition = " '@(ResxWithCulture)' != ''"             Sources = "@(ResxWithCulture)"             UseSourcePath = "$(UseSourcePath)"             StateFile = "$(IntermediateOutputPath)$(MSBuildProjectFile).CrossCompileResGen.Cache"             OutputResources = "@(ManifestResourceWithCultureName->'$(IntermediateOutputPath)%(Identity).resources')"         >                    

 

 

然后新建一个2005的c#项目 或者转换一个2003的项目到2005的项目格式. 取名为: myApp

手工编辑myApp.csproj

替换 整个节点

保存

重新加载项目

在配置管理器(Configuration Manager)里面

平台(platform)下拉菜单里面 选择.NET 1.1

OK. 如果代码没有问题就可以编译了

Enjoy

[在VS2005 环境下面使用.NET Framework 1.1 进行编译]的回复

Post a Comment~