MSBuild.Sdk.SqlProj
MSBuild.Sdk.SqlProj copied to clipboard
MSB3073: Sdk.targets The command exited with code 1
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 "$(DacpacToolExe)" 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>
Please share your csproj (and format as code)
<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>
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()
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.
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 What version of Visual Studio are you using? I haven't seen this before to be honest.
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.2.0
Can you share a repro project?
@ErikEJ added you to the repo
@jmogera I do not see any MSBuild.Sdk.SqlProj projects there, only the .sqlproj !?
I was looking at the wrong branch- everything builds and project properties work fine for me.
Why do you have Remove on all the .sql scripts?
Not sure what you mean "Remove". in the syntax? or the file name itself?
@jmogera Is this still an issue with VS 17.4?
Closing as this seems to be a VS issue, and may have been fixed in later versions.