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

MSB3073: Sdk.targets The command exited with code 1

Open jmogera opened this issue 3 years ago • 13 comments

Installed the template and added all the sql files + 1 post deployment script. When go to build the project. It failes with MSB3073 error.

File: sdk.targets

Points to this line:

<Exec Command="$(DacpacToolCommand)" ConsoleToMsBuild="true" EchoOff="true" StandardOutputImportance="Low"
          Condition="'$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true'">

in <Target Name="GetIncludedFiles" DependsOnTargets="ValidateEnvironment"> <!-- Build arguments for the command line tool --> <PropertyGroup> <PreDeploymentScriptArgument>@(PreDeploy->'--predeploy %(Identity)', ' ')</PreDeploymentScriptArgument> <PostDeploymentScriptArgument>@(PostDeploy->'--postdeploy %(Identity)', ' ')</PostDeploymentScriptArgument> <DebugArgument Condition="'$(MSBuildSdkSqlProjDebug)' == 'True'">--debug</DebugArgument> <DacpacToolCommand>dotnet &quot;$(DacpacToolExe)&quot; collect-includes $(PreDeploymentScriptArgument) $(PostDeploymentScriptArgument) $(DebugArgument)</DacpacToolCommand> </PropertyGroup> <!-- Run it, except during design-time builds --> <Message Importance="low" Text="Running command: $(DacpacToolCommand)" /> <Exec Command="$(DacpacToolCommand)" ConsoleToMsBuild="true" EchoOff="true" StandardOutputImportance="Low" Condition="'$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true'"> <Output TaskParameter="ConsoleOutput" PropertyName="IncludedFiles" /> </Exec> <Message Importance="low" Text="Included Files: $(IncludedFiles)" /> </Target>

jmogera avatar May 17 '22 15:05 jmogera

Please share your csproj (and format as code)

ErikEJ avatar May 17 '22 15:05 ErikEJ

<Project Sdk="MSBuild.Sdk.SqlProj/2.0.0">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <SqlServerVersion>Sql150</SqlServerVersion>
        <!-- For additional properties that can be set here, please refer to https://github.com/rr-wfm/MSBuild.Sdk.SqlProj#model-properties -->
    </PropertyGroup>

    <PropertyGroup>
        <!-- Refer to https://github.com/rr-wfm/MSBuild.Sdk.SqlProj#publishing-support for supported publishing options -->
    </PropertyGroup>

    <ItemGroup>
      <None Remove="GetIntegrations.sql" />
      <None Remove="GetIntegrationsByIntegratingEntity.sql" />
      <None Remove="IntegratingEntities.sql" />
      <None Remove="IntegratingEntityMappings.sql" />
      <None Remove="IntegrationTypes.sql" />
      <None Remove="RemoveIntegration.sql" />
      <None Remove="UpdateIntegration.sql" />
    </ItemGroup>


	<ItemGroup>
		<PostDeploy Include="..\Post-Deployment\Script.PostDeployment.sql" />
	</ItemGroup>
</Project>

jmogera avatar May 17 '22 16:05 jmogera

Also get this error when right click db project => properties: Microsoft.VisualStudio.ProjectSystem.Query.QueryExecutionException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.EntryPointFinder.FindEntryPoints(INamespaceSymbol symbol) at Microsoft.VisualStudio.ProjectSystem.Properties.StartupObjectsEnumGenerator.<GetListedValuesAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.ProjectSystem.PropertyPages.PageDynamicEnumProperty.<CreateAdmissibleValuesAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Query.SupportedValueDataProducer.<CreateSupportedValuesAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Query.QueryDataFromProviderStateProducerBase1.<SendRequestAsync>d__0.MoveNext() --- End of inner exception stack trace --- at Microsoft.VisualStudio.ProjectSystem.Query.QueryExecution.QuerySubscription1.<RunQueryOnceAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.Query.QueryExecution.QuerySubscription1.<>c__DisplayClass8_0.<<Start>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<InitializeAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<CreateAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertiesEditor.<>c__DisplayClass0_0.<<-ctor>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.AsyncLoadContent.<>c__DisplayClass0_0.<<Initialize>b__0>d.MoveNext()

jmogera avatar May 17 '22 22:05 jmogera

Could you share the full output of dotnet build as well? First time I'm seeing this, so we're just trying to figure out where it goes wrong exactly.

jmezach avatar May 21 '22 08:05 jmezach

Found the issue with PostDeployment script. It was not pointing to correct folder. I updated it and the dotnet build works fine now. However I still get the error throws when trying to bring up properties view for the project.

Microsoft.VisualStudio.ProjectSystem.Query.QueryExecutionException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.EntryPointFinder.FindEntryPoints(INamespaceSymbol symbol) at Microsoft.VisualStudio.ProjectSystem.Properties.StartupObjectsEnumGenerator.<GetListedValuesAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at

jmogera avatar May 23 '22 18:05 jmogera

@jmogera What version of Visual Studio are you using? I haven't seen this before to be honest.

jmezach avatar May 24 '22 07:05 jmezach

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.2.0

jmogera avatar May 24 '22 17:05 jmogera

Can you share a repro project?

ErikEJ avatar May 24 '22 18:05 ErikEJ

@ErikEJ added you to the repo

jmogera avatar Jun 08 '22 16:06 jmogera

@jmogera I do not see any MSBuild.Sdk.SqlProj projects there, only the .sqlproj !?

ErikEJ avatar Jun 08 '22 18:06 ErikEJ

I was looking at the wrong branch- everything builds and project properties work fine for me.

ErikEJ avatar Jun 08 '22 18:06 ErikEJ

Why do you have Remove on all the .sql scripts?

ErikEJ avatar Jun 08 '22 18:06 ErikEJ

Not sure what you mean "Remove". in the syntax? or the file name itself?

jmogera avatar Jun 08 '22 23:06 jmogera

@jmogera Is this still an issue with VS 17.4?

ErikEJ avatar Nov 22 '22 14:11 ErikEJ

Closing as this seems to be a VS issue, and may have been fixed in later versions.

ErikEJ avatar Dec 02 '22 13:12 ErikEJ