obiwanjacobi / vst.net

Virtual Studio Technology (VST) for .NET. Plugins and Host applications.
https://obiwanjacobi.github.io/vst.net/index.html
GNU Lesser General Public License v2.1
420 stars 52 forks source link

Error: VST.NET2-Host is not built for the 'AnyCPU' platform. #36

Closed mmichaelc closed 4 years ago

mmichaelc commented 4 years ago

I've attempted to build the Host sample by adding the VST.NET2-Host NuGet package but i get this message: .nuget\packages\vst.net2-host\2.0.0-rc2\build\VST.NET2-Host.targets(6,5): Error: VST.NET2-Host is not built for the 'AnyCPU' platform. You need to specify either platform x86 or x64.

I've followed the documentation here: https://obiwanjacobi.github.io/vst.net/GettingStarted.html I'm wondering if I've missed something.

Thank you for any advice.

To Reproduce This can be reproduced in a basic console app.

This is the contents of the csproj file: `

Exe netcoreapp3.1

`

Desktop (please complete the following information): Windows 10

obiwanjacobi commented 4 years ago

Because VST.NET interoperates with native (unmanaged) code there is no more Any-CPU, which is .NET feature for (pure) managed code. You have to setup x64 or x86 (32-bits) in the Configuration Manager in Visual Studio. Take a look at the Samples Host project (file), you'll see there is no AnyCpu there.

Not sure but you could try pasting this into the PropertyGroup of your project file <Platforms>x64;x86</Platforms>

mmichaelc commented 4 years ago

Ah, thanks for the explanation. I've added Platform="x86" in the PackageReference tag and also <Platform>x86</Platform> under the PropertyGroup and that works.

Thanks!

mmichaelc commented 4 years ago

Got a different error now that's similar:

Command `vstnet publish C:\Users\<user>\vst.net\Source\Samples\Jacobi.Vst.Samples.Host\bin\x86\Debug\netcoreapp3.1\Jacobi.Vst.Samples.Host.dll -o C:\Users\<user>\vst.net\Source\Samples\Jacobi.Vst.Samples.Host\bin\x86\Debug\netcoreapp3.1\deploy` encountered an error.
  System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\<user>\.nuget\packages\VST.NET2-Host\2.0.0-rc1\lib\netcoreapp3.1\AnyCPU'.

I'm not sure why that AnyCPU is there, I don't see any reference to AnyCPU in the project. I'll try to do the publish step manually.

I'm using Visual Studio Code so maybe it doesn't have the same capabilities as Visual Studio.

Thanks

obiwanjacobi commented 4 years ago

Don't have any experience with using Visual Studio Code. But I see 2 things: The AnyCPU and its looking for RC1 - where your project file references RC2...? I assume that the NuGet package cache IS at 'C:\Users\.nuget\packages'..?

mmichaelc commented 4 years ago

The publish was reading the processor architecture 'MSIL' in the built dll. After adding <PlatformTarget>x86</PlatformTarget> to the csproj file under PropertyGroup it now works.

Thanks for the pointers.