Генератору не удалось создать источник. FileNotFoundException
Как добавить внешнюю библиотеку NSwag.CodeGeneration.CSharp в source generator проект c#?
В дебаге происходит следующая ошибка: "Генератору не удалось создать источник. Это не повлияет на выходные данные и ошибки компиляции, которые могут возникнуть в результате. Тип возникшего исключения: "FileNotFoundException", сообщение: "Could not load file or assembly 'NSwag.CodeGeneration.CSharp, Version=13.20.0.0, Culture=neutral, PublicKeyToken=c2d88086e098d109'. Не удается найти указанный файл."
Структура проекта:
- G.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Generator</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="NSwag.CodeGeneration.CSharp"
Version="13.20.0"
PrivateAssets="all"
GeneratePathProperty="true"/>
<None Include="$(OutputPath)\$(AssemblyName).dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
<None Include="$(PKGNSwag_CodeGeneration_CSharp)\lib\netstandard2.0\*.dll"
Pack="true"
PackagePath="analyzers/dotnet/cs"
Visible="false"/>
</ItemGroup>
<PropertyGroup>
<GetTargetPathDependsOn>
$(GetTargetPathDependsOn);GetDependencyTargetPaths
</GetTargetPathDependsOn>
</PropertyGroup>
<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker
Include="$(PKGNSwag_CodeGeneration_CSharp)\lib\netstandard2.0\NSwag.CodeGeneration.CSharp.dll"
IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>
</Project>
- G\Properties\launchSettings.json
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"Generators": {
"commandName": "DebugRoslynComponent",
"targetProject": "../GenTest/GenTest.csproj"
}
}
}
- и сам генератор