Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop VS2015 from converting my.csproj into .sqlproj?

I got an old solution and I am trying to build a newer one using the current projects in it. One of the projects is SQLUtils that contains only .cs files and the Target framework of it is .NET Framework 2.0.

In the old solution it is a regular C# Class Library project but when I add it to my new solution it becomes .sqlproj and I get errors while building it.

I tried to edit the new .sln like the old one, but that didn't make any difference.

I looked at https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38113dcd-caaa-4704-ad69-d7ce774d2916/sql-server-data-tools-september-edition-migration-issues-vs2010?forum=ssdt

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

but they didn't exactly solved it, you know MSDN...

Additional information: solution file:

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

.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>

Each time I add the project a file named "UpgradeLog.htm" is created.
This is how it looks like: UpgradeLog.htm

like image 850
Offir Avatar asked Aug 31 '17 14:08

Offir


People also ask

How do I open a .csproj file in Visual Studio 2022?

csproj or . sln extension. Double-click the . csproj file to open it in Visual Studio.

What is a Csproj file?

What is a CSProj file? Files with CSPROJ extension represent a C# project file that contains the list of files included in a project along with the references to system assemblies.


2 Answers

Referencing the following article from Code Project

List of Visual Studio Project Type GUIDs

There isn't an easy way to change the type of a project in Visual Studio project once it is created; for example changing a C# Class Library into a Portable Class Library (PCL). Knowing these GUIDs will allow you to edit project files like .csproj and .vbproj to easily change a project type in cases where Visual Studio will not allow using the GUI.

Lets take a look at the project type GUIDs in the code snippets you showed above

solution file:

{E24C65DC-7377-472B-9ABA-BC803B73C61A} = Web Site Project
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} = C# Project

Looking at the solution file it makes mention of the above project types. All the other GUIDs are the unique project ids for the projects themselves.

The .csproj: has the following project type GUIDs

<ProjectTypeGuids>{c252feb5-a946-4202-b1d4-9916a0590387};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Where the project type GUIDs

{c252feb5-a946-4202-b1d4-9916a0590387} = Visual Database Tools
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} = C# Project

Quoting again from the article, replacing the code in relation to the OP

Notes

  1. You will find these properties as a <ProjectTypeGuids> element in the project file, not to be confused with <ProjectGuid> which is a unique identifier for your project.
  2. Some GUIDs are used in combination. For example <ProjectTypeGuids>{c252feb5-a946-4202-b1d4-9916a0590387};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> describes a Visual Database Tools library in C#.

I would suggest you try remove/replacing the Visual Database Tools Project Type Guid {c252feb5-a946-4202-b1d4-9916a0590387} from the .csproj project file before trying to open it in the newer IDE

like image 177
Nkosi Avatar answered Oct 22 '22 14:10

Nkosi


I managed to solve this issue by combining Camilo Tervento comment and Nkosi answer.
I removed from the cs.proj:

<Import Project="$(MSBuildBinPath)\SqlServer.targets" />

and from the <ProjectTypeGuids> I removed:

c252feb5-a946-4202-b1d4-9916a0590387

Which is the type of Visual Database Tools project like Nkosi mentioned earlier.
Now the project compiles as expected without any errors, Thank you!

like image 23
Offir Avatar answered Oct 22 '22 13:10

Offir