Skip to content

SQL generated script is not copied when referenced a MSBuild.Sdk.SqlProj #788

@GillesTourreau

Description

@GillesTourreau

When we activate the generation of SQL Script with the <GenerateCreateScript> property, the generated script is not copied if the database project is referenced by an other project.

To reproduce the issue:

  • Create a MSBuild.Sdk.SqlProj database project with one SQL object (a table for example) : MyDatabase.csproj
  • Set the following MSBuild properties:
<Project Sdk="MSBuild.Sdk.SqlProj/3.2.0">
  <PropertyGroup>
      <GenerateCreateScript>True</GenerateCreateScript>
  </PropertyGroup>
</Project>
  • Create a C# project (unit test for example) : MyUnitTests.csproj
  • Add a reference to the MyDatabase.csproj project previously created.
  • Set the ReferenceOutputAssembly property to false in the <ProjectReference> added.
<ItemGroup>
   <ProjectReference Include="..\MyDatabase\MyDatabase.csproj" ReferenceOutputAssembly="False" />
</ItemGroup>
  • Compile the MyUnitTests.csproj project.

The MyDatabase_Create.sql is generated in the bin output folder of the MyDatabase.csproj project. But it is not copied in the MyUnitTests.csproj output bin folder.

NB: For the MyDatabase.dacpac, it is generated in the output bin folder of the MyDatabase.csproj and copied in the MyUnitTests.csproj output bin folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions