dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
21.04k stars 4.9k forks source link

.NET Core 2.0 Console App and publish by SCD (win10-x64) will fail #1039

Closed vulcanlee closed 7 years ago

vulcanlee commented 7 years ago

Issue Title

I use Visual Studio 2017 (15.4.1) and just create a .NET Core 2.0 Console Project, then publish by RuntimeIdentifiers of win10-x64 and show dialog for "Publish failed" and will get "Could not copy the file "obj\Release\netcoreapp2.0\win10-x64\ConsoleApp3.dll" because it was not found" error message.

Any other RuntimeIdentifiers will also publish failed.

This result will cause me to fail to produce SCD files.

But if I publish above SCD by CLI : dotnet publish -c Release -r win10-x64, it work fine and no problem.

General

My environment is Windows 10 Build 1607 or 1709, and Visual Studio 2017 Enterprise 15.4.1.

The content of .csproj is

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
  </PropertyGroup>

</Project>

Following is my console app sample code

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }

You can see my all operation on this video.

Following is build output log:

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
1>------ Build started: Project: ConsoleApp3, Configuration: Release Any CPU ------
1>ConsoleApp3 -> C:\Vulcan\GitHub\temp\ConsoleApp3\ConsoleApp3\bin\Release\netcoreapp2.0\ConsoleApp3.dll
2>------ Publish started: Project: ConsoleApp3, Configuration: Release Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1705,1701,1702,2008 /nostdlib+ /platform:x64 /errorreport:prompt /warn:4 /define:TRACE;RELEASE;NETCOREAPP2_0 /errorendlocation /preferreduilang:en-US /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\Microsoft.CSharp.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\Microsoft.VisualBasic.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\Microsoft.Win32.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\mscorlib.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\netstandard.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.AppContext.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Buffers.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Collections.Concurrent.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Collections.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Collections.Immutable.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Collections.NonGeneric.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Collections.Specialized.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.Annotations.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.Composition.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.DataAnnotations.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.EventBasedAsync.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ComponentModel.TypeConverter.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Configuration.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Console.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Core.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Data.Common.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Data.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.Contracts.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.Debug.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.DiagnosticSource.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.FileVersionInfo.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.Process.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.StackTrace.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.TextWriterTraceListener.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.Tools.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.TraceSource.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Diagnostics.Tracing.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Drawing.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Drawing.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Dynamic.Runtime.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Globalization.Calendars.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Globalization.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Globalization.Extensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.Compression.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.Compression.FileSystem.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.Compression.ZipFile.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.FileSystem.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.FileSystem.DriveInfo.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.FileSystem.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.FileSystem.Watcher.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.IsolatedStorage.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.MemoryMappedFiles.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.Pipes.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.IO.UnmanagedMemoryStream.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Linq.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Linq.Expressions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Linq.Parallel.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Linq.Queryable.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Http.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.HttpListener.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Mail.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.NameResolution.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.NetworkInformation.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Ping.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Requests.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Security.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.ServicePoint.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.Sockets.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.WebClient.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.WebHeaderCollection.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.WebProxy.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.WebSockets.Client.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Net.WebSockets.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Numerics.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Numerics.Vectors.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ObjectModel.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.DispatchProxy.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Emit.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Emit.ILGeneration.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Emit.Lightweight.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Extensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Metadata.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Reflection.TypeExtensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Resources.Reader.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Resources.ResourceManager.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Resources.Writer.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.CompilerServices.VisualC.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Extensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Handles.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.InteropServices.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.InteropServices.RuntimeInformation.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.InteropServices.WindowsRuntime.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Loader.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Numerics.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Serialization.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Serialization.Formatters.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Serialization.Json.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Serialization.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Runtime.Serialization.Xml.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Claims.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Cryptography.Algorithms.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Cryptography.Csp.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Cryptography.Encoding.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Cryptography.Primitives.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Cryptography.X509Certificates.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.Principal.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Security.SecureString.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ServiceModel.Web.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ServiceProcess.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Text.Encoding.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Text.Encoding.Extensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Text.RegularExpressions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Overlapped.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Tasks.Dataflow.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Tasks.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Tasks.Extensions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Tasks.Parallel.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Thread.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.ThreadPool.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Timer.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Transactions.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Transactions.Local.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.ValueTuple.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Web.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Web.HttpUtility.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Windows.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.Linq.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.ReaderWriter.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.Serialization.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.XDocument.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.XmlDocument.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.XmlSerializer.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.XPath.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Xml.XPath.XDocument.dll /reference:C:\Users\vulcan\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\WindowsBase.dll /debug- /debug:portable /filealign:512 /nologo /optimize+ /out:obj\Release\netcoreapp2.0\win10-x64\ConsoleApp3.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /target:exe /warnaserror- /utf8output /deterministic+ Program.cs "C:\Users\vulcan\AppData\Local\Temp\.NETCoreApp,Version=v2.0.AssemblyAttributes.cs" obj\Release\netcoreapp2.0\win10-x64\ConsoleApp3.AssemblyInfo.cs /warnaserror+:NU1605
2>Could not copy the file "obj\Release\netcoreapp2.0\win10-x64\ConsoleApp3.dll" because it was not found.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
livarcocc commented 7 years ago

Does this only happen if you set the RuntimeIdentifiers? If you remove that property, does VS build successfully?

It seems like VS is looking for the dll in the wrong output folder: it should look under bin and not obj. Does it work if you run msbuild.exe ConsoleApp3.csproj?

If that fails as well, could you run msbuild.exe ConsoleApp3.csproj /bl:log.binlog and then share the binlog file with us?

vulcanlee commented 7 years ago

@livarcocc

  1. Yes, this only happed if I set the RuntimeIdentifiers and when I remove this property, VS will build successfully.

  2. I run msbuild.exe ConsoleApp3.csproj and it works fine.

livarcocc commented 7 years ago

@Pilchie given that this works in VS and the command line, can you have someone take a look at it from the ProjectSystem point of view. Also noted that I tried on the latest 15.5 bits and I can't repro it.

vulcanlee commented 7 years ago

@livarcocc

I just install VS 2017 Preview and re-create a new project, then publish by RuntimeIdentifiers of win10-x64. This progress also is failed.

But the dialog of publish failed show a log file and I have put as following

2017/10/21 10:41:39 System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Model.DefaultPublishSteps.<>c__DisplayClass22_0.b1() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Model.DefaultPublishSteps.d19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.d__102.MoveNext() ---> (Inner Exception #0) System.Exception: Publishing failed.<---

===================

Petermarcu commented 7 years ago

Can you try win-x64 instead of win10-x64?

vulcanlee commented 7 years ago

@Petermarcu

I have changed to win-x64

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
  </PropertyGroup>

</Project>

but it also got following error log on my VS2017 15.5 preview.

2017/10/22 下午 08:02:19
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Model.DefaultPublishSteps.<>c__DisplayClass22_0.<IsBuildCompletedSuccessfully>b__1()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__102.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---

===================
Petermarcu commented 7 years ago

And it does still work from the command line with dotnet publish -r win-x64?

vulcanlee commented 7 years ago

@Petermarcu

Yes, it work fine and all files for SCD have been generated.

C:\Vulcan\Gitbook\Temp\ConsoleApp1>dotnet publish -r win-x64

  ConsoleApp1 -> C:\Vulcan\Gitbook\Temp\ConsoleApp1\ConsoleApp1\bin\Debug\netcoreapp2.0\win-x64\ConsoleApp1.dll
  ConsoleApp1 -> C:\Vulcan\Gitbook\Temp\ConsoleApp1\ConsoleApp1\bin\Debug\netcoreapp2.0\win-x64\publish\

C:\Vulcan\Gitbook\Temp\ConsoleApp1>
doggy8088 commented 7 years ago

@Petermarcu Does VS2017 invoke dotnet.exe CLI internally?

NPSF3000 commented 7 years ago

Just encountered this issue.

livarcocc commented 7 years ago

@Pilchie @natidea this stack seems to be inside VS itself. Can you guys direct this to the right person?

Pilchie commented 7 years ago

@BillHiebert is this yours?

Petermarcu commented 7 years ago

@BillHiebert is probably the closest person to be able to describe what VS publish does internally. I'm not sure that it calls out to dotnet.exe.

BillHiebert commented 7 years ago

@vijayrkn - can you respond?

vijayrkn commented 7 years ago

I think It is failing from VS because the runtimeIdentifier to use during publish is not specified. You are specifying it for the commandline scenario when you pass this flag (-r win-x64) but this is not specified in the VS publish scenario.

Solution: 1.You can either change the RuntimeIdentifiers to RuntimeIdentifier in the csproj and publish from VS should succeed.

  1. You can keep the RuntimeIdentifiers in csproj but for the profile that you are publishing, you can specify the RuntimeIdentifier to use. This can be done from the profile settings UI or adding this property(RuntimeIdentifier) to the pubxml under Properties\PublishProfiles\profilename.pubxml
vulcanlee commented 7 years ago

@vijayrkn

I have changed RuntimeIdentifiers to RuntimeIdentifier in the csproj and can publish from VS successfully.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>

</Project>

If I use multiple RIDs, like this : win-x64;osx-x64;rhel-x64 in the csproj and republish any one of RIDs. The project of Visual Studio will become unavailable.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifier>win-x64;osx.10.11-x64;rhel-x64</RuntimeIdentifier>
  </PropertyGroup>

</Project>

But in this web page Self-contained deployment without third-party dependencies, the <RuntimeIdentifiers> tag can use multiple RIDs.

My question is that how can I use multiple RIDs in the csproj and can publish from VS?

Multiple RIDs

vijayrkn commented 7 years ago

if you want to specify multiple RIDs in the csproj, then you need to set RuntimeIdentifiers instead of RuntimeIdentifier in the csproj (In the above screenshot you are missing the trailing 's' ).

<RuntimeIdentifiers>win-x64;osx.10.11-x64;rhel-x64</RuntimeIdentifiers>

Once this is set, you can restore the project and go to the publish setting page and pick the RID that you need to publish with (and click save). Then you will be able to publish for that specific RID.

vulcanlee commented 7 years ago

@vijayrkn

When I set RuntimeIdentifiers in the csproj and specify multiple RIDs, and publish any RID (change from publish setting page) from Visual Studio will be failed.

vijayrkn commented 7 years ago

@vulcanlee Thank you for reporting this issue. We can reproduce the issue on our side with the latest released bits. We will investigate the root cause and get back.

/cc @mlorbetske

Petermarcu commented 7 years ago

@vijayrkn do you still need this open here? Is the issue understood and is there any more that can be shared?

Petermarcu commented 7 years ago

Just followed up internally. This is the same issue as: https://developercommunity.visualstudio.com/content/problem/101502/vs2017-153-net-core-20-publish-a-self-contained-ap.html

They are planning on fixing this in the release of Visual Studio 2017 v15.5.

felschr commented 6 years ago

This issue is still present in the latest stable VS release. Is it being worked on?

vulcanlee commented 6 years ago

@FelschR

You can use CLI to publish SCD

vijayrkn commented 6 years ago

@FelschR - The fix for this issue will be available in the next upcoming release. Until then the work-around will be to add the following to the csproj <RuntimeIdentifier>win-x64</RuntimeIdentifier>

rliberoff commented 6 years ago

It is 2018, we already had at least two update to version 15.5 and this error still happens!

atodd-geoplan commented 6 years ago

Assets file 'C:\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0/win-x64'

Petermarcu commented 6 years ago

@vijayrkn any updates on which release the fix is supposed to be in?

vijayrkn commented 6 years ago

The fix is available in the current VS preview - https://www.visualstudio.com/thank-you-downloading-visual-studio/?ch=pre&sku=Enterprise&rel=15

yangar commented 6 years ago

Still have the problem on build 15.5.4

vijayrkn commented 6 years ago

@yangar The fix is in 15.6 preview (link in the above comment). Can you please try with the latest VS preview build?

doggy8088 commented 6 years ago

Still have the problem on build 15.5.5

livarcocc commented 6 years ago

@doggy8088 @vijayrkn can confirm, but I don't believe we put this fix in the servicing of 15.5, but rather in 15.6.

vijayrkn commented 6 years ago

As I mentioned in my above comment the fix is only available in 15.6

vaklove commented 6 years ago

Hi I am still facing same issue . I can not publish through visual studio . I have latest 15.5.6 VSC 2017. Please look below attached screen shot.

image

image

Petermarcu commented 6 years ago

@mlorbetske where should this issue go?

mlorbetske commented 6 years ago

We could move it to aspnet/websdk & my team can pick it up from there.

vijayrkn commented 6 years ago

@vaklove The fix is available only in 15.6 and above. https://github.com/dotnet/core/issues/1039#issuecomment-361039743

You can install the latest preview version of 15.6 from here and that should have the fix https://www.visualstudio.com/thank-you-downloading-visual-studio/?ch=pre&sku=Enterprise&rel=15

Petermarcu commented 6 years ago

Ok, if its already fixed, then there is no need to move the issue.

ian-g-holm-intel commented 6 years ago

@vijayrkn I just downloaded VS 15.6 Preview 5 to test this out and it does publish successfully. However, SCD file dependencies are not included in the publish directory. If I trun dotnet publish -c Release -r win10-x64 from the CLI, all files are published correctly. It's only when publish from VS that files are missing.

vijayrkn commented 6 years ago

@Retik - Can you please confirm if you have the RuntimeIdentifiers/RuntimeIdentifier specified in csproj & RuntimeIdentifier specified in the pubxml?

ian-g-holm-intel commented 6 years ago

@vijayrkn Yes I have it in my csproj. It look like this. RuntimeIdentifiers>win10-x64;ubuntu-x64</RuntimeIdentifiers I do not have a pubxml though, do I need one?

ian-g-holm-intel commented 6 years ago

@vijayrkn Sorry, I do have a pubxml, they each have the following lines for the two profiles. RuntimeIdentifier>win10-x64</RuntimeIdentifier RuntimeIdentifier>ubuntu-x64</RuntimeIdentifier

vijayrkn commented 6 years ago

@Retik - I just tried this scenario with the latest 15.6 preview release and VS was generating the right publish outputs for the RIDs you specified above:

Sample app that I tried: https://github.com/vijayrkn/RIDPublishSample win10-x64 output - https://github.com/vijayrkn/RIDPublishSample/tree/master/ConsoleApp32/bin/Release/PublishOutput/win10-64 Ubuntu-x64 output - https://github.com/vijayrkn/RIDPublishSample/tree/master/ConsoleApp32/bin/Release/PublishOutput/Ubuntu-x64

PublishProfiles - https://github.com/vijayrkn/RIDPublishSample/tree/master/ConsoleApp32/Properties/PublishProfiles

The above output matched the output from cli. Are you seeing a different behavior? If so, can you please share a sample project?

ian-g-holm-intel commented 6 years ago

@vijayrkn Figured out my issue was that I had similar publish directories in two different locations and I wasn't looking in the correct directory where VS was publishing. Everything is working now. Thanks for the help.

It appears that a directory with the same name gets created inside the netcoreapp2.0 directory that doesn't include all the publish collateral. This is why I was confused because the directory I wanted was bin/Release/ubuntu-x64 instead of bin/Release/netcoreapp2.0/ubuntu-x64.

vijayrkn commented 6 years ago

Glad to know it is working.

gitchomik commented 6 years ago

I tested it on 15.6, and this has been fixed BUT partly. When you have projects X and Y (refers to X), and X, Y have both <RuntimeIdentifiers>win10-x64;debian.8-x64;</RuntimeIdentifiers>. Then when Publishing Y still does NOT work, and show error message. (It works when X doesn't have any <RuntimeIdentifiers>, but then X probablly wasn't published with valid RID)

BTW: It also does NOT work, when publish ASP.NET Core

vijayrkn commented 6 years ago

@gitchomik you can set the RuntimeIdentifier on the dependent projects csproj and publish should succeed.

BTW: It also does NOT work, when publish ASP.NET Core

Just tried the same scenario on ASP.NET core projects and it behaves the same way as .NET core projects. Can you please provide a sample project where you are seeing an issue with publish?

gitchomik commented 6 years ago

@vijayrkn https://github.com/gitchomik/dotnet_core_issues_1039

  1. Run VS.NET 15.6.4 and load solution
  2. Select project "ConsoleApp" then click "Publish" from context menu, then "FolderProfile" and "Publish"
  3. VS.NET show error message https://imgur.com/a/I04VA
  4. Select project "WebApplication1" then click "Publish" from context menu, then "FolderProfile" and "Publish"
  5. VS.NET show error message https://imgur.com/a/rEhte
joepour commented 6 years ago

Hey guys, seems the issue is still here. Currently having this error:

image

.csproj

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>

VS Version: image

vijayrkn commented 6 years ago

@joepour you need to update the VS version to 15.6. The above VS version is still 15.5.7

@gitchomik I will take a look at the same project you provided.