4
votes

Using the latest Service Fabric SDK (5.7.198) and Visual studio Professional 15.3.1

I'm having problems just trying to debug or deploy a aspnetcore2.0 stateless service. I have made no changes to the project after the project creation wizard, apart from adding a new controller.

I've tried reinstalling both x64 and x86 versions of .Net Core SDK. The project is set to x64. Below is the entire .csproj

  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Microsoft.ServiceFabric" Version="5.7.198" />
    <PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="2.7.198" />
    <PackageReference Include="Microsoft.ServiceFabric.Data" Version="2.7.198" />
    <PackageReference Include="Microsoft.ServiceFabric.Services" Version="2.7.198" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.visualstudio.web.codegeneration.design\2.0.0\lib\net461\dotnet-aspnet-codegenerator-design.exe", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyApi C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1987

May be related to this issue.Github issue

I've published my code for replication GitHub Repo

1
I put <PlatformTarget>x64</PlatformTarget> in my services' csproj files (I put it under the first PropertyGroup) as a workaround. As SF libraries are x64 only, I think this is okay to do - unless someone can advise otherwise!Mardoxx
@Mardoxx added this but still get the warning in my output windowTim
Hmm have you tried setting your targets as x64 on the build config menu?Mardoxx
doesnt seem to help @Mardoxx just added the repo to this question. really basic repo. If i do a webapi then i can debug. Think the problem is when you add an mvc template, and then scaffold a new controller. Whatever the reference is added is the wrong bit type i think.Tim
I get the same issue! May be worth linking your repro on that github issue!Mardoxx

1 Answers

4
votes

I have a solution for this. You need to remove the Microsoft.VisualStudio.Web.CodeGeneration.Design package from the project. You can either do it either through the .csproj file or through the NuGet package manager. Once you have removed this, it will build and run fine.