如何阻止VS2015将my.csproj转换为.sqlproj?

Off*_*'er 8 .net c# csproj visual-studio-2015

我有一个旧的解决方案,我正在尝试使用其中的当前项目构建一个新的解决方案.其中一个项目是SQLUtils,它只包含.cs文件,而它的Target框架.NET Framework 2.0.

在旧的解决方案中,它是一个常规的C#类库项目,但是当我将它添加到我的新解决方案时,它变成.sqlproj并且在构建它时出现错误.

我试着像旧的那样编辑新的.sln,但这没有任何区别.

我查看了https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38113dcd-caaa-4704-ad69-d7ce774d2916/sql-server-data-tools-september-edition-migration-issues-vs2010 ?论坛= SSDT

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0f537da4-9d61-45bf-8778-102eae9d4b83/csproj-to-sqlproj-migration-in-vs2012-with-ssdt?forum= SSDT

但他们并没有完全解决它,你知道MSDN ...

其他信息: 解决方案文件:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "BO 25.7.17", "BO 25.7.17", "{5C12D821-9F39-4C47-A888-DD65E5CD6464}"
    ProjectSection(WebsiteProperties) = preProject
        SccProjectName = "SAK"
        SccAuxPath = "SAK"
        SccLocalPath = "SAK"
        SccProvider = "SAK"
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv2.0"
        ProjectReferences = "{f977dcec-ed6c-485f-ab12-1fe31b7cbc5c}|Logic.dll;"
        Debug.AspNetCompiler.VirtualPath = "/localhost_61694"
        Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\TFS\StyleRiver\BO\BO 25.7.17\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_61694\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "false"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/localhost_61694"
        Release.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\TFS\StyleRiver\BO\BO 25.7.17\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_61694\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = "true"
        Release.AspNetCompiler.FixedNames = "false"
        Release.AspNetCompiler.Debug = "False"
        VWDPort = "61694"
        SlnRelativePath = "..\..\..\..\..\..\TFS\StyleRiver\BO\BO 25.7.17\"
    EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logic", "Logic\Logic.csproj", "{F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Debug|Mixed Platforms = Debug|Mixed Platforms
        Debug|x64 = Debug|x64
        Debug|x86 = Debug|x86
        Release|Any CPU = Release|Any CPU
        Release|Mixed Platforms = Release|Mixed Platforms
        Release|x64 = Release|x64
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|x64.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|x64.Build.0 = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Debug|x86.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|Any CPU.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|Any CPU.Build.0 = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|x64.ActiveCfg = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|x64.Build.0 = Debug|Any CPU
        {5C12D821-9F39-4C47-A888-DD65E5CD6464}.Release|x86.ActiveCfg = Debug|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|x64.ActiveCfg = Debug|x64
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|x64.Build.0 = Debug|x64
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Debug|x86.ActiveCfg = Debug|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|Any CPU.Build.0 = Release|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|x64.ActiveCfg = Release|x64
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|x64.Build.0 = Release|x64
        {F977DCEC-ED6C-485F-AB12-1FE31B7CBC5C}.Release|x86.ActiveCfg = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(TeamFoundationVersionControl) = preSolution
        SccNumberOfProjects = 2
        SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
        SccTeamFoundationServer = http://gpnt049:8080/tfs/zap%20market%20-%20zap%20travel
        SccWebProject0 = true
        SccProjectUniqueName0 = BO\u002025.7.17
        SccProjectName0 = BO\u002025.7.17
        SccAuxPath0 = http://gpnt049:8080/tfs/zap%20market%20-%20zap%20travel
        SccLocalPath0 = BO\u002025.7.17
        SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
        SccProjectEnlistmentChoice0 = 2
        SccProjectUniqueName1 = Logic\\Logic.csproj
        SccProjectName1 = Logic
        SccAuxPath1 = http://gpnt049:8080/tfs/zap%20market%20-%20zap%20travel
        SccLocalPath1 = Logic
        SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
    EndGlobalSection
EndGlobal
Run Code Online (Sandbox Code Playgroud)

.csproj的:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectTypeGuids>{c252feb5-a946-4202-b1d4-9916a0590387};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{80A3D07F-863D-4E34-A5D4-8587A201629E}</ProjectGuid>
    <OutputType>Library</OutputType>
    <NoStandardLibraries>false</NoStandardLibraries>
    <AssemblyName>SQLUtils</AssemblyName>
    <RootNamespace>SQLUtils</RootNamespace>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FileUpgradeFlags>40</FileUpgradeFlags>
    <OldToolsVersion>4.0</OldToolsVersion>
    <UpgradeBackupLocation>C:\TFS\StyleRiver\StyleRiver 24.7.17\Backup1\</UpgradeBackupLocation>
    <ConnectionString />
    <PublishUrl>publish\</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Disk</InstallFrom>
    <UpdateEnabled>false</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <UseApplicationTrust>false</UseApplicationTrust>
    <BootstrapperEnabled>true</BootstrapperEnabled>
    <SccProjectName>
    </SccProjectName>
    <SccLocalPath>
    </SccLocalPath>
    <SccAuxPath>
    </SccAuxPath>
    <SccProvider>
    </SccProvider>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <WarningLevel>4</WarningLevel>
    <DeployCode>true</DeployCode>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    <DefineConstants>TRACE</DefineConstants>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildBinPath)\SqlServer.targets" />
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.XML" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Concat.cs" />
    <Compile Include="ConcatDistinct.cs" />
    <Compile Include="Encryption.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="SqlRegEx.cs" />
    <Compile Include="ToUrlCompatible.cs" />
  </ItemGroup>
  <!-- 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>
  -->
  <ItemGroup>
    <None Include="Test Scripts\Test1.sql" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
      <Visible>False</Visible>
      <ProductName>Windows Installer 3.1</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
  </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

每次添加项目时,都会创建一个名为"UpgradeLog.htm"的文件.
这是它的样子: UpgradeLog.htm

Nko*_*osi 4

参考代码项目中的以下文章

Visual Studio 项目类型 GUID 列表

Visual Studio 项目创建后,没有一种简单的方法可以更改项目类型;例如,将 C# 类库更改为可移植类库 (PCL)。了解这些 GUID 将允许您编辑 .csproj 和 .vbproj 等项目文件,以便在 Visual Studio 不允许使用 GUI 的情况下轻松更改项目类型。

让我们看一下上面显示的代码片段中的项目类型 GUID

解决方案文件:

{E24C65DC-7377-472B-9ABA-BC803B73C61A} = Web Site Project
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} = C# Project
Run Code Online (Sandbox Code Playgroud)

查看解决方案文件,它提到了上述项目类型。所有其他 GUID 都是项目本身的唯一项目 ID。

.csproj 具有以下项目类型 GUID

<ProjectTypeGuids>{c252feb5-a946-4202-b1d4-9916a0590387};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Run Code Online (Sandbox Code Playgroud)

其中项目类型 GUID

{c252feb5-a946-4202-b1d4-9916a0590387} = Visual Database Tools
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} = C# Project
Run Code Online (Sandbox Code Playgroud)

再次引用文章,替换OP相关代码

笔记

  1. 您会发现这些属性是<ProjectTypeGuids>项目文件中的一个元素,不要与<ProjectGuid>项目的唯一标识符混淆。
  2. 一些 GUID 可以组合使用。例如,<ProjectTypeGuids>{c252feb5-a946-4202-b1d4-9916a0590387};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 描述了 C# 中的可视化数据库工具库。

我建议您尝试从.csprojVisual Database Tools项目文件中删除/替换项目类型 Guid ,然后再尝试在较新的 IDE 中打开它{c252feb5-a946-4202-b1d4-9916a0590387}