-
Notifications
You must be signed in to change notification settings - Fork 508
Produce build error when target framework is not netcoreapp #5361
Comments
The fix for this issue is included in https://github.com/dotnet/corert/pull/5329/files. However, CoreRT will work well for .NET Core only. It won't work well for .NET Framework. It will happen to to work when your console app references surface that is common between the two, but it is easy to step outside of it by accident. We should print error when the target framework is not netcoreapp. Is there a reason why you cannot target .NET Core with your console app? |
Ah ok, I seemed to have missed the fact that net47 is not suited for CoreRT. CoreRT should have rang a bell though^^. My reason for using .Net Framework was System.Windows.Forms which provides the OpenFileDialog class but I can live without that. But even using .Net Core 2.0 I still have errors:
These are other error types (MissingMethod and ClassLoadGeneral) but seem to be sort of similar as I spot a .Private. again in System.Private.CoreLib. But the mentioned methods are not part of my own code btw. |
These errors are issues with the framework that we are bundling with CoreRT:
|
Could I circumvent these errors by not using certain functions (I use Reflection for example) or is it hard to figure out what exactly the cause is for those? And btw, thx for the fast responses and even fixes. Very appreciated. |
System.Xml.Xsl and System.Xml.Serialization errors are caused by something in your app is using types from System.Xml.Xsl and System.Xml.Serialization namespaces - either directly or indirectly. Does that help? |
It makes sense as my code is signing and serializing an XML. But as I get it, this is not supported currently? |
Correct. Components that depend on Reflection.Emit are not supported by CoreRT currently. |
The uapaot flavors of those assemblies might work. I haven't tried XSL, but Serialization should be able to fall back to reflection. |
I want to make a .NET 4.7 console app a windows native exe and I was already successful in doing so with certain projects by adding the nuget package Microsoft.DotNet.ILCompiler and then calling dotnet publish -r win-x64 -f net47 -c Release xxx.csproj. But now I get a warning message like this:
I solved some of these errors before by just adding a reference to the missing assembly in the csproj file. But in this specific case System.Private.Xml is missing, which afaik is not part of the .Net Framework 4.7 and I am not sure how I reference it exactly.
The text was updated successfully, but these errors were encountered: