'C# project build task won't run with error: The "CreateCSharpManifestResourceName" task could not be initialized with its input parameters
I tried to prevent satellite assemblies generation for embedded resources in my C# project. Here part, which fails whole project (I copied it from here How to prevent resource assembly generation for embedded resources)
<!-- Overriding this task in order to set ManifestResourceName and LogicalName -->
<UsingTask TaskName="CreateCSharpManifestResourceName" TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ResourceFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]"
Required="true" />
<RootNamespace ParameterType="System.String"
Required="true" />
<PrependCultureAsDirectory
ParameterType="System.Boolean" />
<ResourceFilesWithManifestResourceNames
ParameterType="Microsoft.Build.Framework.ITaskItem[]"
Output="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
foreach (ITaskItem item in ResourceFiles) {
var link = item.GetMetadata("Link").Replace("\\", "/");
link = "/" + link.TrimStart('/');
item.SetMetadata("ManifestResourceName", link);
item.SetMetadata("LogicalName", link);
}
ResourceFilesWithManifestResourceNames = ResourceFiles;
</Code>
</Task>
</UsingTask>
So, after running the build task, it shows 2 errors:
The "CreateCSharpManifestResourceName" task could not be initialized with its input parameters.
and
The "UseDependentUponConvention" parameter is not supported by the "CreateCSharpManifestResourceName" task loaded from assembly: Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from the path: ...\Microsoft.Build.Tasks.Core.dll. Verify that the parameter exists on the task, the points to the correct assembly, and it is a settable public instance property.
I already tried to fully cleanup project temp files, and gac, but this error appears again. I'm using Visual Studio 2019 Enterprice, and my project based on .NET Framework 4.6.2.
[In addition]: I'm using two files as embedded resources:
- Localization\Resources.ini
- Localization\Resources.ru-RU.ini
Help me please to solve this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
