C# VS 2013 Error 02019: Invalid target type for /target: must specify 'exe', 'winexe', 'library', 'module', 'appcontainerexe' or 'winmdobj' CSC
Asked Answered
F

3

1

I work on a website that uses various class libraries that are occasionally updated. One of the libraries is a sqlproj file and I believe it was made with VS2010. It is a dependency for other libraries and I'm not able to build/rebuild my solution because I keep getting this error, thus the DLLs will not generate. When I first open the project in VS2013, I get a migration report that opens in my browser. But the migration states that it's successful. When I try building the project, I get the error:

Error 1 02019: Invalid target type for /target: must specify 'exe', 'winexe', 'library', 'module', 'appcontainerexe' or 'winmdobj' CSC

I've tried to follow some of the recommendations on this question with essentially the same issue, but have been unsuccessful. Project fails to load due to missing SqlServer.targets file after upgrading to Visual Studio 2013 It seems like there are some unresolved streams in that question as well.

Any help would be great. Happy to provide more details and/or edit the question to make it more generalized. Thanks in advance.

Fizzy answered 18/9, 2015 at 19:3 Comment(0)
F
2

While none of the answers in Project fails to load due to missing SqlServer.targets file after upgrading to Visual Studio 2013 worked for me, and nobody else had ideas here on Stack Overflow, it turns out this was a bug related to backwards compatibility in Visual Studio 2013 and SSDTs (SQL Server Developer Tools). A comment in this forum solved my issue:

https://connect.microsoft.com/SQLServer/feedbackdetail/view/979839

Posted by bsclifton on 11/15/2014 at 7:18 AM

Had this issue too with the Community 2013 edition; Going to Tools->Extensions and Updates and updating "Microsoft SQL Server Update for database tooling" resolved the issue :)

Fizzy answered 13/10, 2015 at 19:27 Comment(0)
E
1

Changed .sqlproj file with following as per the advised on other stack workflow thread. Worked for me.

$(MSBuildToolsPath) to $(MSBuildBinPath) in import tag

Eda answered 25/10, 2018 at 13:57 Comment(0)
S
0

I had the same error message but on VS2017 in .sqlproj. It helped to add DefaultTargets argument in .targets file.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="SetDacVersionToAssemblyVersion" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

  <Target Name="SetDacVersionToAssemblyVersion" AfterTargets="CoreCompile" Condition=" '$(EnableDacVersionFromAssembly)' == 'True' ">
    <GetAssemblyIdentity AssemblyFiles="$(IntermediateTargetFullFileName)">
      <Output TaskParameter="Assemblies" PropertyName="IntermediateTargetAssembly" />
    </GetAssemblyIdentity>
    <PropertyGroup>
      <DacVersion>$(IntermediateTargetAssembly.Split(',')[1].Split('=')[1])</DacVersion>
    </PropertyGroup>
  </Target>

</Project>
Stichous answered 5/12, 2017 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.