5

I have a solution containing several projects target both net461 and netcoreapp2.0. Also the solution contains VSIX projects with my DslTools extension. VSIX projects use old csproj format while other projects use new csproj format (SDK). But all projects use PackageReference format for nuget references.
So no packages.config, no project.json.

The VSIX project depends on Microsoft.VSSDK.BuildTools nuget package and other packages from VSExtensibility family.

For DSL Tools I have to copy required assets from DSL SDK (Modeling SDK) into my project and reference them explicitly.

The solution is being built in VS2017 just fine.

When I build it via dotnet CLI (dotnet build) I get such an error:

D:\..\src\packages\microsoft.vssdk.buildtools\15.5.72\tools\VSSDK\Microsoft.VsSDK.targets(82,5): error MSB4062: The "CompareCommonBuildTaskVersion" task could not be loaded from the assembly D:...\src\packages\microsoft.vssdk.buildtools\15.5.72\tools\VSSDL\Microsoft.VisualStudio.Sdk.BuildTasks.dll. Could not load file or assembly 'System.IO.Packaging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Probably MSBuild under dotnet CLI can't load Microsoft.VisualStudio.Sdk.BuildTasks.dll from VSSDK.

So a VSIX project cannot be built with dotnet CLI.

Then I try to build via msbuild.exe. It should work as it works in VS but it doesn't.

At this time I'm getting:

"D:..\Src\DslDesigner\Dsl\Dsl.csproj" (default target) (2) ->
(ResolveNuGetPackageAssets target) ->
Z:\Prog\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(184,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [D:...\Src\DslDesigner\Dsl\Dsl.csproj]

It's kinda obsolete message in NuGet according this issue. But it's about the message not about an error.

VSIX-csproj's have: ToolsVersion="15.0" TargetFrameworkVersion=4.6.1

So I have no idea how to build my solution in command line. Any suggestion?

Shrike
  • 9,218
  • 7
  • 68
  • 105

1 Answers1

5

What helped to resolve the issue - I added the following property into ALL my (old format) csproj-s related to VSIX:

<RuntimeIdentifiers>win</RuntimeIdentifiers>
Shrike
  • 9,218
  • 7
  • 68
  • 105
  • After updating our MSBuild tools we ran into into the following error: `project.json doesn't have a runtimes section, add '“runtimes”: { “win”: { } }' `. This ended up resolving our issue, no other format or value worked. (e.g. or using win-x86 as value or anything). Cheers! Adding this comment so perhaps others with the same issue can find it. – Lauw Mar 21 '18 at 17:58