【发布时间】:2018-04-06 22:54:42
【问题描述】:
我有一个解决方案,其中包含多个针对 net461 和 netcoreapp2.0 的项目。该解决方案还包含带有我的 DslTools 扩展的 VSIX 项目。 VSIX 项目使用旧的 csproj 格式,而其他项目使用新的 csproj 格式 (SDK)。但是所有项目都使用 PackageReference 格式作为 nuget 引用。
所以没有packages.config,没有project.json。
VSIX 项目依赖于Microsoft.VSSDK.BuildTools nuget 包和来自 VSExtensibility 系列的其他包。
对于 DSL 工具,我必须将所需资产从 DSL SDK(建模 SDK)复制到我的项目中并明确引用它们。
解决方案在VS2017中构建就好了。
当我通过 dotnet CLI (dotnet build) 构建它时,出现这样的错误:
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'.
可能 dotnet CLI 下的 MSBuild 无法从 VSSDK 加载 Microsoft.VisualStudio.Sdk.BuildTasks.dll。
因此无法使用 dotnet CLI 构建 VSIX 项目。
然后我尝试通过 msbuild.exe 构建。它应该像在 VS 中一样工作,但它没有。
此时我得到:
"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]
根据issue,它在 NuGet 中有点过时了。但这是关于消息而不是错误。
VSIX-csproj 有: 工具版本="15.0" TargetFrameworkVersion=4.6.1
所以我不知道如何在命令行中构建我的解决方案。有什么建议吗?
【问题讨论】:
标签: .net msbuild visual-studio-2017 vsix vs-extensibility