I have a Visual Studio 2017 solution which contains .NET Standard, .NET Core, and .NET Framework projects. My .NET Framework 4.6.2 project is using PackageReferences in the .csproj file - instead of a packages.config.
This seems to be the new way of specifying NuGet packages and will allow future migration to .NET Standard 2.0 (I hope). https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files
csproj:
<ItemGroup>
<PackageReference Include="LanguageExt.Core">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.SqlServer.Dac">
<Version>1.0.3</Version>
VS displays cool icons:
Anyway, the solution compiles fine under Visual Studio but fails with build errors when compiling via cake.
Databases\DatabaseInstaller.cs(5,27): error CS0234: The type or namespace name 'Dac' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?) [C:\code\Core.AcceptanceTesting\Core.AcceptanceTesting.csproj]
Are these newer "PackageReferences" supported by cake build?
Here's a segment from my cake script:
// NuGet restore packages for .NET Framework projects (and .NET Core projects)
Task("NuGet-Restore")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(solutionFile);
});
// NuGet restore packages for .NET Core projects only
Task("DotNetCoreRestore")
.IsDependentOn("NuGet-Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
ArgumentCustomization = args => args.Append("/p:Version=" + versionPrefix + "-" + versionSuffix)
};
DotNetCoreRestore(settings);
});
// Build our solution
Task("Build")
.IsDependentOn("DotNetCoreRestore")
.Does(() =>
{
DotNetCoreBuild(
solutionFile,
new DotNetCoreBuildSettings()
{
ArgumentCustomization = args => args.Append("/p:Version=" + versionPrefix + "-" + versionSuffix),
Configuration = configuration
});
});
I downloaded your repo and got it building. Use the build definition below. Reason it works in Visual Studio is because it uses MSBuild and Nuget.exe. Don't call DotNetCoreX-commands on NET Framework.