Appveyor CI fails to build a .net core 2.1 solution with a database project - msbuild

Our .net core 2.1 solution compiles fine on our local development machines with .net core sdk 2.1.301. Appveyor used to compile the solution in its CI pipeline when there was no database projects defined. Once such a project added, Appveyor started failing in building the solution with the error message below. Any clues how to address this issue?
C:\projects\comingsoon\ComsingSoonDatabase\ComsingSoonDatabase.sqlproj(57,3):
error MSB4019: The imported project "C:\Program
Files\dotnet\sdk\2.1.300\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.

The database project can only be built using the full framework MSBuild tools included in visual studio.
Depending on how you set up appveyor, you need to change your definition to use msbuild.exe instead of dotnet commands.

Related

Project must provide a value for configuration

Project must provide a value for configuration. Msbuild failed wih this error and its working fine if doing build via vs 2017. But breaking when using Msbuild cmdline
Try deleting Microsoft.AspNetCore.Razor.Design in your .csproj file. That worked perfectly for me. I had the same issue, when I migrated my project from .NET Core 2.2 to .NET Core 3.0.

MSBuild error building ASP.Net Core 1.0 project - Imported project was not found

Trying to build a ASP.Net Core 1.0 project (.xproj) on a Build machine. Project built in VS2015. .Net Core is installed on the Build machine. I get this build error
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirmed that path in the declaration is correct, and file exists on disk.
Tried the suggestion from this stackoverflow questionbut doesn't help.
I can confirm that the path and file do exist on the build server.
Also tried passing MS Build Argument /p:VisualStudioVersion=14.
Any leads highly appreciated.

MsBuild failing for .Net Standard project with error "Package System.Security.Cryptography.ProtectedData, version x.x.x was not found"

Project Setup : Mixed framework solution
.Net Framework 4.6.2 projects in solution : 15
.Net Standard 2.0 projects in solution - 1
Development Machine
Visual Studio 2017(15.7.4) : Builds without any errors
Build Server
TeamCity Version 2017.1.3
Build Steps
Nuget Restore(3.4.4)
dotnet Restore
MSBuild( Build Tools 2017), Tools Version 15.0
Build fails with following error in the .net standard 2.0 project : [ResolvePackageAssets] C:\Program Files\dotnet\sdk\2.1.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198, 5): Package System.Security.Cryptography.ProtectedData, version 4.4.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
What's interesting is I can't find reference or use of System.Security.Cryptography.ProtectedData anywhere in the project. Any help is greatly appreciated.
P.S - Can't use dotnet build, as the solution needs building of licenses.licx files, and the component which builds it (Microsoft.Build.Tasks.LC) is not ported to .Net Core. The suggestion from various posts was to use MsBuild.exe

.NET Standard and TFS 2015 -> Build failures

My infrastructure now has TFS 2015, but we started a new project in .NET Standard. Our build server now has VS2017, and the project builds when loaded within VS2017 in that server.
When we set a new build definition to run the build through the build agent, then it fails. Seems even that System is not found:
Error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
Is there any simple thing to do to make it work, ir we will have to migrate to the new build steps to make it work? Some workaround?
I find a workaround for that. Simply I gave up of using the TFS 2015 build steps MSBUILD and Visual Studio Build, and now I am using the Command Line step. Calling the commands from there:
dotnet restore
dotnet build
That does the trick.
This is because we need to do our restore a different way using the .net core restore. You could fix this by adding the .NET Core (PREVIEW) task to the build definition or just use command line task. With command line task could running dotnet restore, dotnet build, dotnet publish, and dotnet test.
More details please take a look at this blog: Setting up .net core continuous integration build with VSTS/TFS
For command line solution please refer vsts-agent Build Definition for .NET Core (with Test Results) Also take a look at this similar question: Visual studio team services build .net core 1.1

.NET 4.5.1 broke MSBUILD

We've been using TeamCity for some time without issues. We went a few weeks without doing builds and our server team installed .NET 4.5.1 on the server. Now all of our builds are breaking.
Here is the command line being ran (edited for privacy):
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>msbuild "C:\programs\TeamCity\bu
ildAgent\work\<path to proj file>.csproj" /t:Package /P:Configuration=Test
Which results in this error:
The target "Package" does not exist in the project.
Lots of results talk about this being a missing visual studio folder named "web" or not having web deploy installed. That is not the case here. Those solutions are not working.