MSBuild.Sdk.SqlProj icon indicating copy to clipboard operation
MSBuild.Sdk.SqlProj copied to clipboard

question: buildAction in my projects is "content" instead of "compile"

Open verquepasa opened this issue 3 years ago • 1 comments

When you create a sdk.sqlproj, all the .sql files in the project are flagged as "Content" and even though this might be confusing, it works: msbuild does not complain. and you get your dacpac and everybody is happy.

Now, an interesting thing happen when I try to get some .sql files included automatically from a nuget package, this is an pattern that I find useful to have an updatable core framework of sql objects combined with a customized solution for each installation.

Ok, so when I include the nuget package, the .sql files are added to the project as with their builAction set as "Compile" and MsBuild refuse to work, maybe because the project is a csproj and msbuild tries to compile them using C#

Thanks again for this open source software, I understand if my problem is too specific and there is no solution, but any hint will be appreciated.

image

verquepasa avatar Jun 14 '21 14:06 verquepasa

I cannot reproduce this issue. @verquepasa Could you share the project files of both the referenced NuGet package containing the .sql files and the project file that references it?

Sample NuGet project containing .sql files:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="**\*.sql">
      <PackageCopyToOutput>true</PackageCopyToOutput>
    </Content>
  </ItemGroup>
</Project>

and accompanying nuspec:

<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <description>$description$</description>
    <authors>$authors$</authors>
    <owners>$authors$</owners>
    <copyright>$copyright$</copyright>
    <tags>$tags$</tags>
    <contentFiles>
      <files include="**/*.sql" />
    </contentFiles>
  </metadata>
  <files>
    <file src="**/*.sql" target="contentfiles\any\any" />
  </files>
</package>

Gets referenced in the consuming project as Content: image

AroglDarthu avatar Sep 12 '21 12:09 AroglDarthu

Closing as no repro, and additional info never supplied.

ErikEJ avatar Nov 22 '22 14:11 ErikEJ