Closed vulcanlee closed 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?
@livarcocc
Yes, this only happed if I set the RuntimeIdentifiers and when I remove this property, VS will build successfully.
I run msbuild.exe ConsoleApp3.csproj and it works fine.
@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.
@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.
===================
Can you try win-x64 instead of win10-x64?
@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.<---
===================
And it does still work from the command line with dotnet publish -r win-x64
?
@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>
@Petermarcu Does VS2017 invoke dotnet.exe
CLI internally?
Just encountered this issue.
@Pilchie @natidea this stack seems to be inside VS itself. Can you guys direct this to the right person?
@BillHiebert is this yours?
@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.
@vijayrkn - can you respond?
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.
@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 :
<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?
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.
@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.
@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
@vijayrkn do you still need this open here? Is the issue understood and is there any more that can be shared?
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.
This issue is still present in the latest stable VS release. Is it being worked on?
@FelschR
You can use CLI to publish SCD
@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>
It is 2018, we already had at least two update to version 15.5 and this error still happens!
Assets file 'C:\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0/win-x64'
@vijayrkn any updates on which release the fix is supposed to be in?
The fix is available in the current VS preview - https://www.visualstudio.com/thank-you-downloading-visual-studio/?ch=pre&sku=Enterprise&rel=15
Still have the problem on build 15.5.4
@yangar The fix is in 15.6 preview (link in the above comment). Can you please try with the latest VS preview build?
Still have the problem on build 15.5.5
@doggy8088 @vijayrkn can confirm, but I don't believe we put this fix in the servicing of 15.5, but rather in 15.6.
As I mentioned in my above comment the fix is only available in 15.6
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.
@mlorbetske where should this issue go?
We could move it to aspnet/websdk & my team can pick it up from there.
@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
Ok, if its already fixed, then there is no need to move the issue.
@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.
@Retik - Can you please confirm if you have the RuntimeIdentifiers/RuntimeIdentifier specified in csproj & RuntimeIdentifier specified in the pubxml?
@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?
@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
@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?
@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.
Glad to know it is working.
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
@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?
@vijayrkn https://github.com/gitchomik/dotnet_core_issues_1039
Hey guys, seems the issue is still here. Currently having this error:
.csproj
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>
VS Version:
@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.
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.
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
Following is my console app sample code
You can see my all operation on this video.
Following is build output log: