How to use dotnet (.NET Core) to pack a sln file that contains an sql project?

I have nothing special about .NET Core, you can name it Application.sln, and it contains 12 C # projects and 1 SQL project. In Visual Studio 2017, I have no problem creating all the projects, but when I head to the command line to package projects using dotnet pack Application.sln --no-build, I immediately encounter a problem with the sql project. Here is the error:

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.1.0\Microsoft\VisualStudio\v14.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk

After I decoded this, I found out that the first part C:\Program Files\dotnet\sdk\1.1.0comes from me using dotnet instead of msbuild to package the solution, and since SSDT cannot be installed in the dotnet folder, this will not work.

I would like it to ignore the .sqlproj project and only package .csproj projects, as I will process sql projects separately after that, but I see no way to do this. Is there any way? It doesn't look like I can use wild cards like MSBuild as a parameter dotnet pack(***. Csproj), as this causes a separate error.

I tried using msbuild / t: pack, but it gives me other problems (it says the target “package” does not exist in the project).

Does anyone have any suggestions for me? If this helps, I want to do it through TeamCity, but all these problems exist on my development machine.

+4
source share
1 answer

-, dotnet, , #. , msbuild VS 2017 (dotnet restore = > msbuild /t:Restore ..)

Pack NuGet, Microsoft.NET.Sdk SDK ( "" csproj) NuGet.Build.Tasks.Pack nuget , .

dotnet pack/msbuild /t:Pack sql-, .

- Directory.Build.props :

<Project>
  <Target Name="Pack" />
</Project>

Pack. , .NET SDK, NuGet. , msbuild /t:Pack SQL NuGet Pack #.

+4

Source: https://habr.com/ru/post/1684575/


All Articles