sdk: dotnet pack uses wrong path for obj artifact and fails on Preview5
Executing dotnet pack in a project directory with a P2P dependency tries to pack using an incorrect artifact path:
error MSB4018: The "PackTask" task failed unexpectedly.
error MSB4018: System.IO.FileNotFoundException: File not found: 'C:\bitbucket\fx\Fx-Core\src\Fx.Core\obj\Debug\Fx.Core.dll'.
error MSB4018: at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)
error MSB4018: at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)
error MSB4018: at NuGet.Commands.MSBuildProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
error MSB4018: at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage(String path)
error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage()
error MSB4018: at NuGet.Build.Tasks.Pack.PackTask.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext()
My project file is as such:
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="..\..\SharedProperties.props" />
<PropertyGroup Label="Configuration">
<RootNamespace>Fx</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<Description>Core library</Description>
<Copyright>Fresh Egg Limited</Copyright>
<AssemblyTitle>FX: Core</AssemblyTitle>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>Fx.Core</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<Compile Include="..\..\SharedVersionInfo.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Authorization">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyModel">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>1.6.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fx.Common\Fx.Common.csproj" />
<ProjectReference Include="..\Fx.Core.Abstractions\Fx.Core.Abstractions.csproj" />
<ProjectReference Include="..\Fx.Data.Abstractions\Fx.Data.Abstractions.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
The generated spec file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Fx.Core</id>
<version>1.0.0</version>
<authors>Fx.Core</authors>
<owners>Fx.Core</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Core library</description>
<copyright>Fresh Egg Limited</copyright>
<dependencies>
<group targetFramework=".NETStandard1.6">
<dependency id="Fx.Common" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="Fx.Core.Abstractions" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="Fx.Data.Abstractions" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Authentication" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Authorization" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Diagnostics" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.StaticFiles" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.EntityFrameworkCore" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.Configuration.Binder" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.Configuration.Json" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.DependencyModel" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.FileProviders.Composite" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.FileProviders.Embedded" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" exclude="Build,Analyzers" />
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
<files>
<file src="C:\bitbucket\fx\Fx-Core\src\Fx.Core\obj\Debug\netstandard1.6\Fx.Core.dll" target="lib\netstandard1.6\Fx.Core.dll" />
<file src="C:\bitbucket\fx\Fx-Core\src\Fx.Core\obj\Debug\Fx.Core.dll" target="lib\Fx.Core.dll" />
</files>
</package>
Observations:
- If I attempt to
dotnet packmyFx.Commonproject which has no P2P dependencies, it packs fine. - If I attempt to pack any of my other projects which have P2P dependencies, the pack fails.
- The
packcommand looks to be looking for/obj/{Configuration}/{OutputFilename}.dllinstead of/obj/{Configuration}/{Framework}/{OutputFilename}.dll. - There are two references to
Fx.Core.dllin the spec file, is this correct?
Environment data
.NET Command Line Tools (1.0.0-preview5-004226)
Product Information:
Version: 1.0.0-preview5-004226
Commit SHA-1 hash: 7b109e4b53
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview5-004226
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (11 by maintainers)
Experiencing same issue… 2.0.0-preview1-005977