Reputation: 8586
I'm trying to build and deploy an ASP.NET Core 2.0.3 Web API through TFS.
In Visual Studio I've configured Release to target the x86 platform. I've also ensured the following in the csproj:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Platforms>x86</Platforms>
</PropertyGroup>
Building locally produces the expected output in folder bin\x86\Debug\netcoreapp2.0
Over in TFS I have a new .NET CORE build configuration with the restore/build/publish tasks. I notice that they don't use the standard BuildPlatform build variable which I've changed from Any Cpu to x86
Build: --configuration $(BuildConfiguration)
Publish: --configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)
They only use BuildConfiguration which is either Debug or Release. This results in an Any CPU dll which will run as x64 on the release server.
I've tried adding -r win7-x86 to the publish command but this has resulted in a self contained deployment being published which isn't what I want.
I've tried adding -r win7-x86 to the build command, which results in the correct dll being produced, but the publish command does it's own implicit build and doesn't use the output of the previous build task.
How can I get TFS to publish an x86 DLL (framework dependent) for the web application?
Upvotes: 2
Views: 635
Reputation: 100581
For .NET Core applications (netcoreapp*
- not ASP.NET Core on .NET Framework), the platform used during build usually doesn't matter.
The bitness is determined through the version of the dotnet.exe
host that is used to load and run the application. E.g. C:\Program Files\dotnet\dotnet.exe
(64 bit) or C:\Program Files (x86)\dotnet\dotnet.exe
(32 bit).
The RuntimeIdentifier
MSBuild property (what the -r
switch sets) is only relevant for self-contained deployments but there is also an option to specify --self-contained false
(=> SelfContained
MSBuild property) so that a runtime-specific application is built without creating a self-contained deployment. This is typically only needed to filter runtime-specific assets - e.g. only include win-x32 versions of a SQLite native library instead of multiple versions for windows/linux/Mac etc. in a runtimes
sub-folder.
Upvotes: 2