System.ArgumentException: Unknown cpu platform ''.
Steps to reproduce:
In VS 2022, create a new c# class library for .NET Framework. Add a simple
public static void TestExport()
Use NuGet package manager and install DllExport 1.7.4 for the project. Check the project checkbox when batchfile gets executed. Do not change anything just apply.
Add [DllExport] in front of the TestExport() method.
Build application.
Then close solution.
Remove the packages folder and the .vs folder and all build folders.
Open the solution again. Use package manager to restore the needed DllExport package.
Build the project.
In all cases you get this error:
The "DllExportAppDomainIsolatedTask" task failed unexpectedly.
System.ArgumentException: Unknown cpu platform ''.
Parameter name: platformTarget
Strangely. When rebuilding again. The build does not fail.
This happens always when the solution is clean of package folder and build folders (so when initially cloned. The first package restore messes something up and a rebuild needs to be done twice to get rid of the error.
DllExport -version: 1.7.4- Used Visual Studio / MSBuild / ...: Visual Studio 2022 community/professional
Hello,
Please read the documentation.
The package should be restored automatically when build is started, you don't need to do anything like restore.
Use package manager to restore the needed DllExport package.
Don't use nuget package manager to avoid weird behavior like this.
Strangely. When rebuilding again. The build does not fail.
Because now the control is delegated correctly to the DllExport manager that must prepare everything for its proper work.
If you need a manual restore, please command like DllExport -action Restore
More about commands: https://github.com/3F/DllExport/wiki/DllExport-Manager But first please start with Configuring the projects
Let me know if you still have problems restoring the package.
Closed due to inactivity. Please open it again if you still have problems or questions.