0

I have following after_build definitions in my appveyor.yml:

after_build:
- cmd: nuget pack "%project_file%" -properties "Configuration=%configuration%" -version "%GitVersion_NuGetVersion%" -symbols
- cmd: nuget pack "%extras_project_file%" -properties "Configuration=%configuration%" -version "%GitVersion_NuGetVersion%" -symbols

Now, I have those two .proj-files, which contain a corresponding .nuspec-file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <authors>$author$</authors>
  </metadata>
</package>

Finally, I have a little addition for the extras_project_file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <authors>$author$</authors>
    <dependencies>
      <dependency id="***project_name***" version="$version$" />
    </dependencies>
  </metadata>
</package>

Actually, project_name is replaced with a hardcoded value for simplicity reasons - no injection with -properties yet. Secondly, any project related elements, such as description and authors, have been omitted to provide a neutral question, despite being mandatory for the actual packing.

project_file is packed succesfully:

Attempting to build package from 'Caliburn.Micro.Contrib.Controller.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Packing files from 'C:\projects\dotnet-caliburn-micro-contrib-controller\src\Caliburn.Micro.Contrib.Controller\bin\Release'.
Using 'Caliburn.Micro.Contrib.Controller.nuspec' for metadata.
Found packages.config. Using packages listed as dependencies
Successfully created package 'C:\projects\dotnet-caliburn-micro-contrib-controller\Caliburn.Micro.Contrib.Controller.0.1.0-unstable0068.nupkg'.

Whereas extras_project_file fails:

Attempting to build package from 'Caliburn.Micro.Contrib.Controller.Extras.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Packing files from 'C:\projects\dotnet-caliburn-micro-contrib-controller\src\Caliburn.Micro.Contrib.Controller.Extras\bin\Release'.
Using 'Caliburn.Micro.Contrib.Controller.Extras.nuspec' for metadata.
Found packages.config. Using packages listed as dependencies
Versions using SemVer 2.0.0 are not supported: 0.1.0-unstable.68+Branch.develop.Sha.7f85e35f315f7fe3ecd35762b65802e5467a57c2.

I am not even sure that this feature (token replacement in <dependencies>) is actually available.

If not, how else can I package two .csproj-files into two separate .nupkg-files, where one has a dependency on the other one with a specific version (same version as the package to build)?

4

1 回答 1

1

我已经为这种情况找到了一种方法 - 但它错过了作为属性%AssemblyInformationalVersion%被标记到最终-.dll文件中(所以我需要检查GitVersionInformation-class 的实际值)。

我添加assembly-informational-format: '{LegacySemVerPadded}'GitVersion.yml.

接下来,我删除了 中的附加dependencies- 元素.nuspec,因此两者再次匹配(=reset)。

最后,我调整了我的after_build

after_build:
  cmd: nuget pack "%project_file%" -properties "Configuration=%configuration%" -symbols 
  cmd: nuget pack "%extras_project_file%" -properties "Configuration=%configuration%" -IncludeReferencedProjects -symbols 
于 2016-12-03T18:08:34.493 回答