-
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 build" fails on non-Windows for projects that multi-target where Desktop is one of the targets frameworks. #826
Comments
@tannergooding #696 , in part, tracks your broader suggestion of skipping invalid frameworks, but the above should atleast ensure you're unblocked. |
@piotrpMSFT, that works for singular projects. That does not work when targeting an entire solution (which is perhaps a separate issue) where not every project targets the desired framework. The command will fail with The workaround would be to build all |
I suppose that this will become an even bigger issue with .net standard / .net core 2.0 given that you may want to reference net* projects. Related: #335 |
@tannergooding yea, the sln issue is MUCH more gnarly. I have a PR that aims to address it, both for RID and for TFM, but it's really invasive and I'm not sure if we'll be able to take it for 1.0.0 at this point. |
@piotrpMSFT, Do you have a link? Is it something akin to |
@livarcocc Is your update saying that this won't even make 2.0 now? Is there any sort of workaround for sln till then? If this was regular MSBuild I assume we could just override the TargetFrameworks parameter from the command line but I don't think that is possible via dotnet.exe. I get that this is only a problem for more complex applications (i.e. not most Asp.Net core apps) but it is a migration blocker for us. |
We need this to build https://github.com/microsoft/rtvs on Mac |
Another reason to have the suggested |
Any updates on this? Currently we have a solution that tests multi target netcoreapp2.0 and net47 and the main library targets netstandard2.0. This compiles and runs tests fine on windows. When on linux, compiling solution always fails regardless of the framework used. |
I solved the issue by installing the Mono and configuring cli with command: |
I tried @bruno-garcia's suggestion and works for me. I can compile the projects targeting .net 4.7 on linux. |
Any update on that? Can I run multitargeted solution on macOS without performing changes in project files? |
3 years has passed - no solution here. Even VS Code can process builds out of box, how can I purchase a product where simple problems persist for years... |
This is at least partially resolved via the existence of https://www.nuget.org/packages/Microsoft.NETFramework.ReferenceAssemblies. Provided you are referencing it, you can successfully build the desktop targets even on Linux and MacOS. There isn't a built-in mechanism to easily build everything but a specific list of target frameworks, but given the NuGet package and other workarounds available, it might not be necessary. |
It's only one of problems. If I just need to build once I can run command in terminal and specify my target. |
This was fixed a while ago, the reference assembly packages should be automatically referenced if you need them. |
@dsplaisted Are you suggesting we no longer need to reference Microsoft.NETFramework.ReferenceAssemblies when multi-targeting? |
@RehanSaeed Yes, starting in the .NET 5 SDK they should be added automatically if you need them: #10981 |
Issue
If you have a project that multi-targets where one of Desktop is one of the target frameworks (such as
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
), then the project will fail to build on non-windows with an error similar to:Expected Result
The Desktop framework should be ignored and a warning should be printed indicated the framework in question could not be built.
This is a reasonable solution since the Desktop framework is not to be available on non-Windows.
Additional Details
This also impacts solutions where some projects target Desktop and some target .NETStandard or .NETCore and projects that only target Desktop.
The text was updated successfully, but these errors were encountered: