我如何打包MSBuild 15的多目标包?

时间:2017-01-17 15:00:47

标签: c# visual-studio msbuild .net-core visual-studio-2017

我正在使用随VS2017 RC一起发布的新MSBuild 15来编译和打包多目标项目。

恢复:SQL> / 1 222 hello 2 222 hello PL/SQL procedure successfully completed. 正常工作。

构建:msbuild /t:restore mysolution.sln正常工作并生成:

msbuild /p:Configuration=Release mylibrary.csproj

但是当我打包时:+ bin/Release + netstandard1.4 - mylibrary.dll + net452 - mylibrary.dll 结构与之前的版本不匹配,如下所示:

msbuild /t:pack /p:Configuration=Release /p:IncludeSymbols=true mylibrary.csproj

来自+ bin/Release + netstandard1.4 - mylibrary.pdb + net452 - mylibrary.pdb - mylibrary.dll 命令的警告告诉我这将会发生,但不确定如何解决它:

/t:pack

注意:

我没有使用C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(73,5): warning : Issue found with package 'MyLibrary'. [D:\XXX\YYY\src\MyLibrary\MyLibrary.csproj] C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(73,5): warning : Issue: Assembly not inside a framework folder. D:\XXX\YYY\src\MyLibrary\MyLibrary.csproj] C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(73,5): warning : Description: The assembly 'lib\MyLibrary.dll' is placed directly under 'lib' folder. It is recommended that assemblies be placed inside a framework-specific folder. C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(73,5): warning : Solution: Move it into a framework-specific folder. If this assembly is targeted for multiple frameworks, ignore this warning. 文件。只有新方式*.nuspec文件有效(https://docs.nuget.org/ndocs/schema/msbuild-targets#pack-target

这是文件的一些相关内容的样子:

*.csproj

1 个答案:

答案 0 :(得分:0)

感谢您的评论。我找到了基于它们的方法。

这就是我所做的:我再次下载了dotnet cli工具并从头开始测试。我意识到cli工具的版本是相同的,所以我开始比较里面的文件。

错误的dotnet cli版本

无效的版本包含以下文件:

+ dotnet
  + sdk
    + 1.0.0-preview2-1-003177
    + 1.0.0-preview2-003131
    + 1.0.0-preview2-003133
    + 1.0.0-preview4-004233

使用dotnet build /t:pack /p:Configuration=Release /p:IncludeSymbols=true mylibrary.csproj显示以下错误:

Couldn't find 'project.json' in '/t:pack'

好的dotnet cli版本

我下载的第二个版本仅包含以下内容:

+ dotnet
  + sdk
    + 1.0.0-preview4-004233

之前执行命令,它可以正常工作:

Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.

...