-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet build should either build or ignore sqlproj SQL project - not error out #10441
Comments
This is by design. The CLI does not try to reason about the set of projects it supports natively because that list of not final. User's can customize their builds to make different project types work. And this has happened before. Our recommendation here is that you either use full framework MSBuild. |
Why doesn't the CLI figure out what projects it can work with? If Microsoft's own tool team can't figure out that the supported projects are for a given release/config, who else is in a better position? As an example, CI scripts are far simpler when relying just on Can you elaborate why this is a design choice? It seems like a very poor choice leading to poor customer experience. The tools are supposed to work for us, making us more productive - not the other way around. Without reasonable dialog, this just seems very lazy (on part of the tool ;) !) |
Because of the open ended nature of MSBuild, verifying if a project is buildable would pretty much require a build to happen, for errors on it to be ignored (how exactly would we discern actual build errors from errors related to the project not being supported) and then a second build would have to happen with some projects excluded. This would be extremely costly and every build would have to pay that cost. We need the evaluation because we don't know which projects are not supported. We have a positive list of projects we support natively, but nothing prevents customers to write their own props/targets to support different project types not originally supported by the CLI. The list is open-ended. |
I see. What about shipping a default This could patch out certain known problematic project types till either they are actually supported by the MSFT tools group or a customer replaces that with a custom/working one? On surface it appears to be simple fix and would be "out of the box" friendly. |
I don't think patching these 1:1 to noop is the right approach here. The number of project types is open ended. Why do one and not the others? Plus, I find the experience of silently ignoring a project type to be very dangerous. Folks may interpret that as success while noop is very far from that. |
@livarcocc a pretty obvious option is to offer an explicit CLI command key.
As far as I understand, as of now, there's no even a workaround, right? The only way to have |
As far as i know, that can be ignored from the target project. |
How do you ignore the SQL project? |
Rightclick on solution in Visual Studio and goto "Configuration Manager". Remove the project from build configuration accordingly. In my case, I left it activated for "Debug" config and removed "build" and "deploy" for "Release" config. |
Will SQL projects ever be supported in .NET Core? If not then are they officially deprecated and is there an alternative? (Other than EF) |
I discovered this alternative, which I've been extremely happy with: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj |
People aren't asking you to make a one off patch. They are asking you to support your own technology that we have relied on for years. The SDK project above is somewhat compelling but it doesn't support the tooling around SQL Server projects such as Schema Compare, DataCompare and SQLCLR (which that too would be nice to get upgraded to dotnet core). |
It looks promising. However it would be nice if this project would have the functionality of the original SQL Server template. It would make things a lot easier for database developers. |
+1 I like this to be re-opened and solved in a more long-term way than to refer to the msbuild-tooling |
Can anyone provide me with a snippet or documentation link on how I can detect within a project file when msbuild is running under the e.g. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsDotnetCliBuild Condition="...">true</IsDotnetCliBuild>
<IsFullMsbuild Condition="...">true<IsFullMsbuild >
</PropertyGroup>
</Project> |
@RyanThomas73, |
Some progress has been made, preview has been released <Sdk Name="Microsoft.Build.Sql" Version="0.1.3-preview" /> |
For anyone else coming across this issue, it's worth noting that you can build from the .NET CLI if, and only if, Visual Studio is also installed. CI builds often build via the .NET CLI, which can still be supported as Visual Studio is also present. Visual Studio and the .NET SDK use different copies of MSBuild, which is why it doesn't intrinsically work. This is useful and interesting when you want to use the CLI, such To achieve this, you'll need a custom targets file that looks like this: <Project>
<PropertyGroup>
<BuildDependsOn>ResolveMSBuild;$(BuildDependsOn)</BuildDependsOn>
<PublishDependsOn>ResolveMSBuild;$(PublishDependsOn)</PublishDependsOn>
</PropertyGroup>
<!-- resolve the version of msbuild that ships with visual studio so we can recursively call ourself from dotnet.exe -->
<Target Name="ResolveMSBuild" Condition=" '$(_MSBuildExe)' == '' ">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">17.0</VisualStudioVersion>
<VsWhere>$(MSBuildProgramFiles32)\Microsoft Visual Studio\Installer\vswhere.exe</VsWhere>
</PropertyGroup>
<!-- determine where vs is installed using vswhere.exe -->
<Exec Command=""$(VsWhere)" -latest -format value -property installationPath" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="VsInstallDir" />
</Exec>
<PropertyGroup>
<_MSBuildExe>$([MSBuild]::NormalizePath($(VsInstallDir)\MSBuild\Current\Bin\MSBuild.exe))</_MSBuildExe>
</PropertyGroup>
</Target>
<!-- override the default targets if building with 'dotnet build' -->
<Target Name="Restore" />
<Target Name="VSTest" />
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)">
<Message Text="$(MSBuildProjectName) -> $(BuildScriptName)" Importance="high" />
<Exec Command=""$(_MSBuildExe)" "$(MSBuildProjectFullPath)" -t:Build -p:Configuration=$(Configuration) -v:m -nologo" />
</Target>
<Target Name="Publish" DependsOnTargets="$(PublishDependsOn)">
<Exec Command=""$(_MSBuildExe)" "$(MSBuildProjectFullPath)" -t:Publish -p:Configuration=$(Configuration) -p:SqlPublishProfilePath=$(SqlPublishProfilePath) -v:m -nologo" />
</Target>
</Project> You can name it whatever you want and place it wherever you want. Let's say we called it <!-- only override the default targets when running via dotnet.exe -->
<Import Project="dotnet.override.targets" Condition=" '$(MSBuildRuntimeType)' == 'Core' " /> Assuming that Visual Studio is found on your box, now you can continued to build from the VS IDE or you can build from the command line with |
Steps to reproduce
*.csproj
) and the other a SQL project (*.sqlproj
).dotnet build
at solution levelExpected behavior
Ideal
The solution is successfully built by either msbuild or natively by the dotnet cli (or a plugin).
Minimum Acceptable
Solution is built by skipping projects (e.g.
sqlproj
) thatdotnet
CLI cannot handleActual behavior
Solution build fails with
error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found
Previous reports
This was previously reported here but was prematurely closed without fixing the bug and subsequently ignored.
Environment data
Click to expand
dotnet --info
output:The text was updated successfully, but these errors were encountered: