DllExport icon indicating copy to clipboard operation
DllExport copied to clipboard

System.ArgumentException: Unknown cpu platform ''.

Open TD-Community opened this issue 1 year ago • 1 comments

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

TD-Community avatar Sep 27 '24 21:09 TD-Community

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.

3F avatar Sep 27 '24 22:09 3F

Closed due to inactivity. Please open it again if you still have problems or questions.

3F avatar Nov 24 '24 23:11 3F