Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSSDK: can't build solution with mixed style csproj-projects containing VSIX-projects

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?

like image 234
Shrike Avatar asked Oct 25 '17 18:10

Shrike


People also ask

How do I create a VSIX project?

Create an empty VSIX project. Select File > New > Project. In the search box, type "vsix" and select either the C# or Visual Basic version of VSIX Project. Add the.zip file to the project.

What is the SDK for my project?

For .NET Core projects, the SDK will often be Microsoft.NET.Sdk or Microsoft.NET.Sdk.Web. Referencing these SDKs simplifies project files a lot. Many details about how our project should be built are abstracted away in the SDK. In “classic” projects, all files in a project would be listed separately.

How do I deploy a custom project template in Visual Studio?

Deploy a Custom Project Template using the VSIX Project template. 1 Open the project from which to create a template. This project can be of any project type. 2 On the Project menu, click Export Template. Complete the steps of the wizard. A .zip file is created in %USERPROFILE%\My Documents\Visual Studio ...

What are SDK-style projects?

Let’s dive in! SDK-style projects are built on top of the Common Project System (CPS), and are a much simpler format than the “old .csproj” format. They typically have an Sdk="..."


1 Answers

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

<RuntimeIdentifiers>win</RuntimeIdentifiers>
like image 188
Shrike Avatar answered Sep 25 '22 15:09

Shrike