-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'dotnet run' fails for self-contained applications #791
Comments
This is the same as #527? @nguerrera |
Does this mean F5 doesn't work on self contained apps? |
I think so. And what Eric describes is the fix I'm thinking about. I'll leave them both open for now. |
I'm looking at making this change today. |
@dougmsft is hitting this as he tries to use .NET Core. |
mmitche
pushed a commit
to mmitche/sdk
that referenced
this issue
Jun 5, 2020
…0190717.11 (dotnet#791) - Microsoft.AspNetCore.Mvc.Analyzers - 3.0.0-preview8.19367.11 - Microsoft.AspNetCore.Mvc.Api.Analyzers - 3.0.0-preview8.19367.11 - Microsoft.AspNetCore.Analyzers - 3.0.0-preview8.19367.11 - Microsoft.AspNetCore.Components.Analyzers - 3.0.0-preview8.19367.11
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using this project on a windows machine:
Raises an error:
Notes
When initially designing .NET Core for MSBuild, we wanted the experience that "framework-dependent vs. self-contained was a publish time decision". That mean that you can take the same .csproj and without modifying it, publish as a "framework-dependent (a.k.a. portable/shared framework)" or a "self-contained" app. In order to support that, a decision was made that
dotnet build
anddotnet run
were always framework-dependent.However, this turns out to not be a great decision because there are scenarios where you want to target a .NET Core runtime that you haven't installed on the machine. In this case, you explicitly choose that you are a self-contained app, and you target the framework version (like a nightly build of Microsoft.NETCore.App) that you want. You still should be able to
dotnet run
your application. The only thing that works today is todotnet publish
and then execute the app, which IDEs don't typically do.To enable this, I think the things that need to be done are:
hostfxr
andhostpolicy
assemblies to the output folderdotnet
executable to the output folder and rename it to $(TargetName)[.exe]dotnet
on the path.the
dotnet
muxer.See https://github.com/dotnet/cli/blob/rel/1.0.0-preview2.1/src/Microsoft.DotNet.Compiler.Common/Executable.cs#L96-L108 for how this worked on project.json based projects. Specifically the
CoreHost.CopyTo(_runtimeOutputPath, _compilerOptions.OutputName + Constants.ExeSuffix);
part, which does the first two steps above.The text was updated successfully, but these errors were encountered: