Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 尝试生成服务结构AspNetCore2项目时出现警告_C#_Visual Studio_Asp.net Core_.net Core_Azure Service Fabric - Fatal编程技术网

C# 尝试生成服务结构AspNetCore2项目时出现警告

C# 尝试生成服务结构AspNetCore2项目时出现警告,c#,visual-studio,asp.net-core,.net-core,azure-service-fabric,C#,Visual Studio,Asp.net Core,.net Core,Azure Service Fabric,使用最新的Service Fabric SDK(5.7.198)和Visual studio Professional 15.3.1 我在调试或部署aspnetcore2.0无状态服务时遇到问题。在项目创建向导之后,我没有对项目进行任何更改,只是添加了一个新的控制器 我已尝试重新安装.Net Core SDK的x64和x86版本。项目设置为x64。下面是整个.csproj <PropertyGroup> <TargetFramework>net461</

使用最新的Service Fabric SDK(5.7.198)和Visual studio Professional 15.3.1

我在调试或部署aspnetcore2.0无状态服务时遇到问题。在项目创建向导之后,我没有对项目进行任何更改,只是添加了一个新的控制器

我已尝试重新安装.Net Core SDK的x64和x86版本。项目设置为x64。下面是整个.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>

net461
win10-x64
真的
项目的处理器体系结构不匹配 正在建设的“AMD64”和处理器架构的参考 “C:\程序 文件\dotnet\sdk\NuGetFallbackFolder\microsoft.visualstudio.web.codegeneration.design\2.0.0\lib\net461\dotnet aspnet codegenerator design.exe“, “x86”。这种不匹配可能会导致运行时失败。请考虑 通过更改项目的目标处理器体系结构 配置管理器,以便调整处理器架构 在项目和引用之间,或者依赖于 使用与目标应用程序匹配的处理器体系结构进行引用 项目的处理器架构。MyApi C:\程序文件 (x86)\Microsoft Visual Studio Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.1987

可能与这个问题有关


我已经发布了复制代码

我有一个解决方案。您需要从项目中删除Microsoft.VisualStudio.Web.CodeGeneration.Design包。您可以通过.csproj文件或NuGet包管理器来完成。一旦您删除了它,它将正常构建和运行。

我将
x64
放在我的服务的csproj文件中(我将它放在第一个
PropertyGroup
下)作为解决方法。由于SF库仅为x64,我认为这是可以做到的-除非有人提出其他建议@Mardoxx添加了这一点,但仍然在我的输出窗口中收到警告嗯,您是否尝试过在“构建配置”菜单中将目标设置为x64?似乎没有帮助@Mardoxx只是在这个问题中添加了repo。真正的基本回购。如果我使用webapi,那么我可以调试。我想问题是当您添加一个mvc模板,然后构建一个新的控制器时。我认为无论添加什么引用,都是错误的位类型。我得到了同样的问题!可能值得在github问题上链接您的复制!