Repro:
in Vs2017 RC (1.0.0-alpha-20161104-2 .net core sdk),
Create a .net standard class library, A
Create another .net standard class library, B
Add project reference to B from A
dotnet restore, build and pack project A
Expected:
a nupkg
Actual:
pack fails with a file not found exception, an incorrect output file somehow gets added as an input.
(also pack target gets imported twice)
dotnet pack
Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2016-12-05 22:49:16.
1>Project "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" on node 1 (pack target(s)).
1>Project "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (1) is building "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj" (2:2) on node 1 (default targets).
2>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
ClassLibrary2 -> D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\bin\Debug\netstandard1.4\ClassLibrary2.dll
GenerateBuildDependencyFile:
Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
2>Done Building Project "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj" (default targets).
1>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
ClassLibrary1 -> D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\netstandard1.4\ClassLibrary1.dll
GenerateBuildDependencyFile:
Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
0>D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\obj\ClassLibrary2.csproj.nuget.g.targets(7,5): warning MSB4011: "C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets" cannot be imported again. It was already imported at "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Microsoft.Common.CurrentVersion.targets (5620,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj]
1>C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: The "PackTask" task failed unexpectedly.\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: System.IO.FileNotFoundException: File not found: 'D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\obj\Debug\ClassLibrary1.dll'.\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.MSBuildProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage(String path)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Build.Tasks.Pack.PackTask.Execute()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
1>Done Building Project "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (pack target(s)) -- FAILED.
Build FAILED.
D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\obj\ClassLibrary2.csproj.nuget.g.targets(7,5): warning MSB4011: "C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets" cannot be imported again. It was already imported at "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Microsoft.Common.CurrentVersion.targets (5620,3)". This is most likely a build authoring error. This subsequent import will be ignored. [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj]
"D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (pack target) (1) ->
(GenerateNuspec target) ->
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: The "PackTask" task failed unexpectedly.\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: System.IO.FileNotFoundException: File not found: 'D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\obj\Debug\ClassLibrary1.dll'.\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.MSBuildProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage(String path)\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Commands.PackCommandRunner.BuildPackage()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at NuGet.Build.Tasks.Pack.PackTask.Execute()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets(73,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.80
Running with /consoleloggerparameters:verbosity=diag
23:02:12.629 1>Target "GenerateNuspec: (TargetId:158)" in file "C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\NuGet.Build.Tasks.Pack.targets" from project "D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (target "Pack" depends on it):
Set Property: PackageVersion=1.0.0
Using "PackTask" task from assembly "C:\Users\aL3891\.nuget\packages\nuget.build.tasks.pack\4.0.0-rc-2048\build\..\CoreCLR\NuGet.Build.Tasks.Pack.dll".
Task "PackTask" (TaskId:77)
Task Parameter:PackItem=D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj (TaskId:77)
Task Parameter:PackageVersion=1.0.0 (TaskId:77)
Task Parameter:PackageId=ClassLibrary1 (TaskId:77)
Task Parameter:Authors=ClassLibrary1 (TaskId:77)
Task Parameter:Description=Package Description (TaskId:77)
Task Parameter:Configuration=Debug (TaskId:77)
Task Parameter:
TargetPathsToAssemblies=
D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\obj\Debug\netstandard1.4\ClassLibrary1.dll
D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1\obj\Debug\ClassLibrary1.dll (TaskId:77)
@aL3891 what version of dotnet.exe are you using?
PS D:\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1> dotnet --version
1.0.0-preview4-004233
@aL3891 i tried this with the latest dotnet.exe version and latest SDK version. This doesn't repro. Could you give it a try please?
Latest NET SDK : https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NET.Sdk
Latest DOTNET.exe : https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip
I got a login prompt when I tried go to that myget, but i'm not sure what to log in as. (its odd because im pretty sure i've been able to get at those packages in the past)
Also,聽how do you set the聽sdk version now聽that the csproj has a sdk attribute? just add it as a regular nuget reference?
I had the strangest when i repo:d this on another machine btw, it sometimes did work, but then the project聽reference聽was not included in the actual nuget, then i reran it, and i got the error in OP,
When you repo:d this, did the classlibrary2.dll end up in the nuget package?
@aL3891 you can just remove the SDK attribute, and add a package reference to the latest SDK version.
classlibrary2.dll will not end up in the nuget package - that is expected behavior. You will have a package reference to classlibrary2 in the nuspec generated in your nupkg.
if that is the design,聽there's another bug because the when I do聽get the error, dotnet pack is trying to add聽classlibrary2 to the package..
It also seems like a little odd to force each assembly to be its own package.. my base library is not useful on its own, having to publish that as a separate package feels really strange
adding the聽sdk nuget gave me the following when聽building:
dotnet build
Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\aL3891\.nuget\packages\microsoft.net.sdk\1.1.0-alpha-20161207-2\build\Microsoft.NET.Sdk.Common.targets(70,5): error : Project 'D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj' has no target framework compatible with '.NETFramework,Version=v4.0'. [D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj]
PS D:\Documents\visual studio 2017\Projects\ClassLibrary1\ClassLibrary1>
my project file looks like this:
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup Label="Configuration">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library">
<Version>1.6</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.1.0-alpha-20161207-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Once the next RC update goes public, would be great to continue to see if this issue is still a problem or not.
np!
Any hint on when that might be? :)
We should be able to give you some bits to play with in a week
@aL3891 would you download the latest CLI+SDK from https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip and let us know if your issue still repros?
Hi, sorry for the delay,
I got a different error with this one:
PS C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1> dotnet build
Microsoft (R) Build Engine version 15.1.522.16164
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB3105: The item "Class2.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. [C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj]
C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(76,5): error : Cannot find project info for 'C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj'. This can indicate a missing project reference. [C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
I tried renaming the files in both projects but I still get the same error,聽I also tied setting聽the file name explicitly instead of聽using a glob
Here are my project files, each project just contain聽a single empty class
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6" />
</ItemGroup>
</Project>
The failing tasks in detail:
13:49:00.773 2:2>Target "CoreCompile: (TargetId:77)" in file "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\Microsoft.CSharp.Core.targets" from project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj" (target "Compile" depends on it):
Building target "CoreCompile" completely.
Output file "obj\Debug\netstandard1.6\ClassLibrary2.dll" does not exist.
Set Property: NoWarn=1701;1702;1705;1701;1702
Set Property: UseSharedCompilation=true
Using "Csc" task from assembly "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll".
Task "Csc" (TaskId:27)
Task Parameter:AllowUnsafeBlocks=False (TaskId:27)
Task Parameter:DebugType=portable (TaskId:27)
Task Parameter:DefineConstants=TRACE;NETSTANDARD1_6;DEBUG (TaskId:27)
Task Parameter:DisabledWarnings=1701;1702;1705;1701;1702 (TaskId:27)
Task Parameter:EmitDebugInformation=True (TaskId:27)
Task Parameter:ErrorReport=prompt (TaskId:27)
Task Parameter:FileAlignment=512 (TaskId:27)
Task Parameter:NoConfig=True (TaskId:27)
Task Parameter:NoLogo=True (TaskId:27)
Task Parameter:NoStandardLib=True (TaskId:27)
Task Parameter:Optimize=False (TaskId:27)
Task Parameter:Deterministic=True (TaskId:27)
Task Parameter:OutputAssembly=obj\Debug\netstandard1.6\ClassLibrary2.dll (TaskId:27)
Task Parameter:Prefer32Bit=False (TaskId:27)
Task Parameter:
References=
C:\Users\Allan\.nuget\packages\microsoft.win32.primitives\4.3.0\ref\netstandard1.3\Microsoft.Win32.Primitives.dll
CopyLocal=false
FusionName=Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
ImageRuntime=v4.0.30319
NuGetIsFrameworkReference=false
NuGetSourceType=Package
OriginalItemSpec=C:\Users\Allan\.nuget\packages\microsoft.win32.primitives\4.3.0\ref\netstandard1.3\Microsoft.Win32.Primitives.dll
Private=false
ReferenceSourceTarget=ResolveAssemblyReference
ResolvedFrom={RawFileName}
Version=
.....
Task Parameter:
Sources=
Class2.cs
Class2.cs
C:\Users\Allan\AppData\Local\Temp\.NETStandard,Version=v1.6.AssemblyAttributes.cs
obj\Debug\netstandard1.6\ClassLibrary2.AssemblyInfo.cs (TaskId:27)
Task Parameter:TargetType=Library (TaskId:27)
Task Parameter:ToolExe=C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\RunCsc.cmd (TaskId:27)
Task Parameter:TreatWarningsAsErrors=False (TaskId:27)
Task Parameter:UseHostCompilerIfAvailable=True (TaskId:27)
Task Parameter:UseSharedCompilation=True (TaskId:27)
Task Parameter:Utf8Output=True (TaskId:27)
Task Parameter:WarningLevel=4 (TaskId:27)
13:49:00.795 2:2>C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB3105: The item "Class2.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. [C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj]
Output Item(s): CscCommandLineArgs= (TaskId:27)
Done executing task "Csc" -- FAILED. (TaskId:27)
13:49:00.820 2:2>Done building target "_CleanRecordFileWrites" in project "ClassLibrary2.csproj".: (TargetId:82)
13:49:00.820 2:2>Done Building Project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj" (default targets) -- FAILED.
13:49:00.826 1>Done executing task "MSBuild" -- FAILED. (TaskId:10)
13:49:00.826 1>Done building target "ResolveProjectReferences" in project "ClassLibrary1.csproj" -- FAILED.: (TargetId:27)
13:49:00.827 1>Target "_DefaultMicrosoftNETPlatformLibrary: (TargetId:83)" in file "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets" from project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (target "GenerateBuildDependencyFile" depends on it):
13:49:00.827 1>Done building target "_DefaultMicrosoftNETPlatformLibrary" in project "ClassLibrary1.csproj".: (TargetId:83)
Target "ComputeDependencyFileCompilerOptions" skipped, due to false condition; ('$(PreserveCompilationContext)' == 'true') was evaluated as ('' == 'true').
13:49:00.827 1>Target "GenerateBuildDependencyFile: (TargetId:84)" in file "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets" from project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (target "_CheckForCompileOutputs" depends on it):
Building target "GenerateBuildDependencyFile" completely.
Output file "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\netstandard1.6\ClassLibrary1.deps.json" does not exist.
Using "GenerateDepsFile" task from assembly "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Sdks\Microsoft.NET.Sdk\build\..\tools\netcoreapp1.0/Microsoft.NET.Build.Tasks.dll".
Task "GenerateDepsFile" (TaskId:37)
Task Parameter:ProjectPath=C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj (TaskId:37)
Task Parameter:AssetsFilePath=C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\obj\project.assets.json (TaskId:37)
Task Parameter:DepsFilePath=C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\netstandard1.6\ClassLibrary1.deps.json (TaskId:37)
Task Parameter:TargetFramework=.NETStandard,Version=v1.6 (TaskId:37)
Task Parameter:AssemblyName=ClassLibrary1 (TaskId:37)
Task Parameter:AssemblyExtension=.dll (TaskId:37)
Task Parameter:AssemblyVersion=1.0.0 (TaskId:37)
13:49:01.027 1>C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(76,5): error : Cannot find project info for 'C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary2\ClassLibrary2.csproj'. This can indicate a missing project reference. [C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj]
Done executing task "GenerateDepsFile" -- FAILED. (TaskId:37)
13:49:01.028 1>Done building target "GenerateBuildDependencyFile" in project "ClassLibrary1.csproj" -- FAILED.: (TargetId:84)
13:49:01.028 1>Done Building Project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (Build target(s)) -- FAILED.
I also get this error when building the second class library by itself so I don't think this聽has聽to do with references
Actually this guy seems to be the cause
1>Target "_GenerateCompileDependencyCache" in file "C:\Program Files\dotnet\sdk\1.0.0-rc4-004527\Microsoft.Common.CurrentVersion.targets" from project "C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (target "Compile" depends on it):
Added Item(s): CustomAdditionalCompileInputs=obj\Debug\netstandard1.6\CoreCompileInputs.cache
Added Item(s):
CoreCompileCache=
C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\Class1.cs
C:\Users\Allan\Documents\Visual Studio 2017\Projects\ClassLibrary1\ClassLibrary1\Class1.cs
C:\Users\Allan\AppData\Local\Temp\.NETStandard,Version=v1.6.AssemblyAttributes.cs
Added Item(s):
Should I open a different issue聽on sdk maybe? (or cli or msbuild perhaps)
Got it working by removing the Compile tag,
As for the pack, it does seem to work now, there are no warnings or errors and ClassLibrary2 does not get聽added to the package but is added as a dependency in the nuspec file witch is by design if I understand correctly?
It would be nice to tell pack to include project references in the package though :) perhaps there is another way to do that
@al3891 we plan to add the capability in 4.0.1 version of nuget. As of now, the best way to do that would be to use a nuspec file - you can use the one generated in the obj folder, and build up on that.
If pack works reasonably for you, could you close this bug?
Allright, cool :)
yeah we can close this one
It would be nice to tell pack to include project references in the package though
I could really use this behavior. This is what I'm doing:
<ItemGroup>
<ProjectReference Include="..\Foo.native\Foo.native.vcxproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="Package">
<None Include="..\Foo.native\bin\$(Configuration)\Foo.native.dll" Pack="True" PackagePath="runtimes\win\native" />
<None Include="..\Foo.native\runtime.json" Pack="True" PackagePath="" />
</ItemGroup>
msbuild Foo.csproj /t:build,pack works beautifully except that this unwanted bit shows up in the nuspec:
<dependency id="Foo.native" version="1.0.0" exclude="Build,Analyzers" />
which is totally wrong. There needs to be some way to prevent a particular ProjectReference from being considered a package dependency. Ideally, I don't want to see a <dependencies> node in the nuspec at all.
@jnm2 add <PrivateAssets>all</PrivateAssets> to the project reference metadata.
@rohit21agrawal Thanks! Where did you find that?
It did not seem to work though :-(
<ItemGroup>
<ProjectReference Include="..\Foo.native\Foo.native.vcxproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
does not seem to have any effect on the nuspec.
@jnm2 did you restore after making the suggested change?
@rohit21agrawal No, that did the trick! You rock! Wish this stuff was documented somewhere on MSDN.
Now, it would be satisfying to get rid of that empty <dependencies> tag. I don't suppose you've got something for that?
@jnm2 glad to help! :) i'll see if i can get it documented. though, in general, this is what we are trying our best to achieve - ProjectReference = PackageReference . Anything that can be be added to a PackageReference in general can also be added to a ProjectReference.
@jnm2 we don't have that, but maybe in the future we can add a -SuppressDependencies switch to make this happen. Feel free to open an issue :)