VSSDK:无法使用包含 VSIX 项目的混合样式 csproj 项目构建解决方案
VSSDK: can't build solution with mixed style csproj-projects containing VSIX-projects
我有一个解决方案包含几个同时针对 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.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.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 Studio17\Enterprise\MSBuild\Microsoft\NuGet.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
所以我不知道如何在命令行中构建我的解决方案。有什么建议吗?
什么有助于解决问题 - 我将以下 属性 添加到与 VSIX 相关的所有(旧格式)csproj-s 中:
<RuntimeIdentifiers>win</RuntimeIdentifiers>
我有一个解决方案包含几个同时针对 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.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.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 Studio17\Enterprise\MSBuild\Microsoft\NuGet.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
所以我不知道如何在命令行中构建我的解决方案。有什么建议吗?
什么有助于解决问题 - 我将以下 属性 添加到与 VSIX 相关的所有(旧格式)csproj-s 中:
<RuntimeIdentifiers>win</RuntimeIdentifiers>