-1
私はnet462とdotnetcore2.0の両方のプロジェクターをコンパイルしています。 私はnet462を設定している。dotnetcore2.0.NET Coreと.NET Frameworkの両方でGetManifestResourceStreamを使用するにはどうすればよいですか?
は動作しているようですが、私はこのような埋め込みリソースをロードする必要があります。
using (var stream = assembly.GetManifestResourceStream("Alcuin.Admin.Api.Beans.TypeTraduction.json"))
using (var reader = new StreamReader(stream))
result = reader.ReadToEnd();
それがnullストリームを私に戻っています。ここで
は私csprojファイルです:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<None Remove="Beans\TypeTraduction.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Beans\TypeTraduction.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Common\Alcuin.Common.Basics\Alcuin.Common.Basics.csproj" />
<ProjectReference Include="..\..\..\..\Common\Alcuin.Common.Graph\Alcuin.Common.Graph.csproj" />
</ItemGroup>
</Project>
誰かがそれを正しく動作させる方法を知っていますか?
ありがとうございました。解決
<ItemGroup>
<None Remove="Beans\TypeTraduction.json" />
</ItemGroup>
問題: