-
Notifications
You must be signed in to change notification settings - Fork 1.1k
dotnet build
error NETSDK1150 | OutputType exe
#18116
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
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
dotnet build
error NETSDK1150 | OutputType exe
By the accident I've discovered that it's a Breaking change: Error generated when executable references executable - .NET | Microsoft Docs I've tested suggested change It would be nice to add error messages to documentation pages because that way it would be indexed and more people would find problem easier rather that spending several hours trying to isolate problem.
|
I second the notion that there should be a link to the documentation in the error message. It's also unclear to me why this is even an error instead of a warning.
This doesn't describe my use of this feature. I somewhat regularly use exe-to-exe references in quick temporary prototypes to use classes out of an executable in another. (Or in today's case, I use it to run unit tests outside the test runner when the test runner is interfering with things.) |
We are using hangfire for job scheduling. My use case: we are referencing first project ( This breaking change forced us to add I also don't see a reason why it's an error. |
Same issue here when referencing another exe. It seems like a weird error "A non self-contained executable cannot be referenced by a self-contained executable." (NETSDK1150) when building with "dotnet publish projecta -c Release -r win-x64 master/projecta". Projecta references projectb, indeed also outputtype exe, like projecta, but the default when building should be "true" according to the documentation, so the references projectb should also be build self-contained before building projecta. Why then this error? It indeed disappears when removing the outputtype exe, but I need that exe. So what happens when building self-contained more explicitly? "dotnet publish projecta -c Release -r win-x64 --self-contained true master/projecta". Then I still get a complaint, but this time dotnet continues the build, but the complaint is: "It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false." (NETSDK1031). I did actually specify the runtime identifier... It seems weird to have to include the flag "ValidateExecutableReferencesMatchSelfContained" in the project, while there is nothing wrong with my project, all references are also build with the same command, so self-contained. Btw: this all started since the most recent update of dotnet, running sdk 5.0.300. |
Hi,
was referencing another project (Web API) that was defined as My solution was to change Sdk.Web to Sdk in csproj for Web API project, but I confirm that ValidateExecutableReferencesMatchSelfContained set to false fixes this problem as well. |
@dsplaisted more feedback on the exe reference error. |
I ended up stripping the exe part of the project and putting that in a separate project, next to a reference to the original project. Quite weird that dotnet generates a dll+exe when outputtype is exe, but does not allow you to reference the project with the exe for a self-contained build. |
I am also having this problem, and where my use case is having a unit test project referencing the exe project. I feel this error is flawed or too broad, encouraging me to disable across all projects... |
I've sent a PR to add a link to these error messages which should help those who encounter it find out how to turn it off: #19392 |
Overview
dotnet restore "C:\Source\Solution1\Solution1.sln" --verbosity="minimal" --runtime="win-x64" --force
dotnet build "C:\Source\Solution1\Solution1.sln" --verbosity="minimal" --configuration="Release" --framework="net5.0" --runtime="win-x64" --no-incremental --no-restore --force
(please see environment_1:output_1
&conf_1
and environment_2:output_2
&conf_2
)output_2
&conf_2
) but is not working on environment_1 (output_1
&conf_1
)Error on environment_1 (
output_1
&conf_1
)Repro solution contains two sample projects
A.csproj
B.csproj
environment_1 |
conf_1
dotnet --info
dotnet msbuild -version
environment_2 |
conf_2
dotnet --info
dotnet msbuild -version
environment_1 |
output_1
environment_2 |
output_2
The text was updated successfully, but these errors were encountered: