我有两个 .NET Standard 1.4 c#项目
Ninja.Domain 引用 Ninja.Abstraction 。
GeneratePackageOnBuild 为true
他们的代码都在 * .csproj 文件中
<PropertyGroup> <BuildNumber Condition=" '$(BuildNumber)' == '' ">0.0.0</BuildNumber> <VersionPrefix>$(BuildNumber)</VersionPrefix> <VersionSuffix Condition=" '$(Configuration)' == 'Debug' ">dev</VersionSuffix> </PropertyGroup>
在vsts我删除了名为 Ninja.Host 的第三个项目,因此请忽略该项目,因为它仅用于演示目的。
在vsts我只做恢复和构建而非打包,发布
我通过BuildNumber
推送/p:BuildNumber=$(Build.BuildNumber)
值作为构建任务**/*.nupkg
我通过复制任务
$(build.artifactstagingdirectory)\nuget
复制到2017-08-07T03:23:50.2098321Z [command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\src\Ninja.Domain\Ninja.Domain.csproj --configuration release /p:BuildNumber=1.0.353
2017-08-07T03:23:50.3518364Z Microsoft (R) Build Engine version 15.1.1012.6693
2017-08-07T03:23:50.3518364Z Copyright (C) Microsoft Corporation. All rights reserved.
2017-08-07T03:23:50.3518364Z
2017-08-07T03:23:51.9897194Z Ninja.Abstractions -> d:\a\1\s\src\Ninja.Abstractions\bin\release\netstandard1.4\Ninja.Abstractions.dll
2017-08-07T03:23:52.1097005Z Successfully created package 'd:\a\1\s\src\Ninja.Abstractions\bin\release\Ninja.Abstractions.1.0.353.nupkg'.
2017-08-07T03:23:53.6697753Z Ninja.Domain -> d:\a\1\s\src\Ninja.Domain\bin\release\netstandard1.4\Ninja.Domain.dll
2017-08-07T03:23:53.7253932Z Successfully created package 'd:\a\1\s\src\Ninja.Domain\bin\release\Ninja.Domain.1.0.353.nupkg'.
2017-08-07T03:23:53.7267788Z C:\Program Files\dotnet\sdk\1.0.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(104,5): warning : Issue found with package 'Ninja.Domain'. [d:\a\1\s\src\Ninja.Domain\Ninja.Domain.csproj]
2017-08-07T03:23:53.7277784Z C:\Program Files\dotnet\sdk\1.0.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(104,5): warning : Issue: Prerelease dependency in stable package. [d:\a\1\s\src\Ninja.Domain\Ninja.Domain.csproj]
2017-08-07T03:23:53.7277784Z C:\Program Files\dotnet\sdk\1.0.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(104,5): warning : Description: A stable release of a package should not have a prerelease dependency. [d:\a\1\s\src\Ninja.Domain\Ninja.Domain.csproj]
2017-08-07T03:23:53.7277784Z C:\Program Files\dotnet\sdk\1.0.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(104,5): warning : Solution: Either modify the version spec of dependency "Ninja.Abstractions [0.0.0-dev, )" or update the version field in the nuspec. [d:\a\1\s\src\Ninja.Domain\Ninja.Domain.csproj]
2017-08-07T03:23:53.7297813Z
2017-08-07T03:23:53.7307788Z Build succeeded.
目录
当我在vsts上对构建进行排队时,我会在下面收到警告。
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Ninja.Abstractions</id>
<version>1.0.353</version>
<authors>Ninja.Abstractions</authors>
<owners>Ninja.Abstractions</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETStandard1.4">
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>
已下载的工件,并有2个文件 Ninja.Abstractions.1.0.353.nupkg 和 Ninja.Domain.1.0.353.nupkg
在 Ninja.Abstractions.1.0.353.nupkg
中打开 Ninja.Abstractions.nuspec<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Ninja.Domain</id>
<version>1.0.353</version>
<authors>Ninja.Domain</authors>
<owners>Ninja.Domain</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETStandard1.4">
<dependency id="Ninja.Abstractions" version="0.0.0-dev" exclude="Build,Analyzers" />
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>
在 Ninja.Domain.1.0.353.nupkg
中打开 Ninja.Domain.nuspec<dependency id="Ninja.Abstractions" version="0.0.0-dev" exclude="Build,Analyzers" />
正如您所看到的那样<dependency id="Ninja.Abstractions" version="1.0.353" exclude="Build,Analyzers" />
应为library(shiny)
library(shinyBS)
shinyApp(
ui = basicPage(
actionButton("show", "Show modal dialog"),
tags$head(tags$style(".modal-dialog{ width:1000px}")),
tags$head(tags$style(".modal-body{ min-height:700px}")),
bsModal('boxPopUp', 'Test','test')
),
server = function(input, output,session) {
observeEvent(input$show, {
toggleModal(session, "boxPopUp", toggle = "toggle")
})
}
)
,并且当我在本地构建它时,此行为不适用。在Visual Studio 2017中,它构建了与正确的依赖关系信息相关的方式。
我正在考虑添加明确的 nuspec 文件,但它会强制我手动跟踪引用,这不是我想做的事情。
我很感激能帮我解决这个问题。
答案 0 :(得分:0)
您还需要将/p:BuildNumber=$(Build.BuildNumber)
传递给dotnet restore
,因为NuGet依赖包版本在恢复时被锁定并写入obj\project.assets.json
文件。请参阅GitHub上的this similar issue。