0

我有一个 Visual Studio 解决方案,其中包含大量项目,其中一些针对 .NET v2.0,其中一些针对 v3.5。

我知道我可以依次右键单击每个项目以查看它的目标版本,但这需要永远。

有谁知道我可以更快地确定哪些项目以 v2.0 为目标,哪些项目以 v3.5 为目标?

编辑:

我希望能够使用 TargetFrameworkVersion 节点来确定版本,但有些项目文件没有这个节点,例如

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E11A268C-9F62-4970-9338-129C35AD2354}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>BusinessEntities</RootNamespace>
    <AssemblyName>Business Entities</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.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="SomeClass.cs" />
    <Compile Include="SomeOtherClass.cs" />
  </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 Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

...但是如果我右键单击 VS 中的项目,它会说目标版本是 .NET v2.0。另外要明确一点,我需要对许多解决方案重复此过程,因此手动方式​​是一个非常不受欢迎的选择。

谢谢

4

1 回答 1

1

There is a link might be helpful. You have to write your own code to parse project files to get the framework versions.

<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> 

The other option is to use command line for the solution folder. Use MS DOS command:

findstr "<TargetFrameworkVersion>" *.csproj

The result will be displayed on the screen.

UPDATE:

Because older progjects don't contain this line. We can use another command, which search files don't contain the line.

findstr /v "<TargetFrameworkVersion>" *.csproj
于 2012-04-27T14:54:57.587 回答