Skip to content

Problem with referencing a COM object from ASP.NET Core 2.1 Targeting .NET 461. #5086

@bmiller-pm

Description

@bmiller-pm

Hi, I've found that just adding a reference to a COM object causes the build to fail with this single error:

….nuget\packages\microsoft.aspnetcore.razor.design\2.1.2\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(69,5): error : The assembly path obj\Debug\net461\win7-x86\Interop.MyComLib.dll is invalid. Assembly paths must be rooted.

As a quick work-around I disabled the error in RazorTagHelper.cs, rebuilt and replaced my current 2.1.2\tasks\netstandard2.0\Microsoft.AspNetCore.Razor.Tasks.dll
It’s unclear to me where the path of the referenced COM import library is stored let alone created. Maybe the “rooted assembly path” check should verify it’s not a COM object first?

   // My work-around is:
       protected override bool ValidateParameters()
        {
           ...
            for (var i = 0; i < Assemblies.Length; i++)
            {
                if (!Path.IsPathRooted(Assemblies[i]))
                {
                    // my COM object doesn't seem to have a rooted path and this fails - so lets make it a warning instead
                    //Log.LogError("The assembly path {0} is invalid. Assembly paths must be rooted.", Assemblies[i]);
                    //return false;
                    Log.LogWarning("The assembly path {0} is invalid. Assembly paths must be rooted.", Assemblies[i]);
                }
            }

Metadata

Metadata

Assignees

Labels

area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.feature-razor-pagesinvestigate

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions