2

I have a C# Console Application targeting .NET framework 4.5.2 (it runs as a Windows service)

I use NuGet packages.

The Visual Studio Error List shows many warnings of the pattern:

Reference '<nuget package>' does not allow partially trusted callers

It also has one interesting line that says:

Use of app.config binding redirects requires full trust

Interestingly enough, I also have a WPF Click-Once app in the same solution that uses many of the same packages, but it does not show the warnings.

I do not get compiler errors when building the console application.

Under the Properties > Security, I have checked "This is a full trust application".

I do not have access to the source code of the NuGet packages that are causing the warnings. Many are very common packages like 'Ninject' and 'EntityFramework.SqlServer', etc.

The questions I have seen other SO questions like this one:

Assembly does not allow partially trusted caller

but it doesn't seem to fit my problem?

I've researched 'strong-named' assemblies, however the WPF Click-Once application that does not show the warnings does not use the Properties > Signing, and it also has bindingRedirect in its App.config?

Turtle1363
  • 312
  • 3
  • 16
  • 1
    `bindingRedirect` requires 'strong-named' assemblies. Perhaps this requirement is not satisfied. – Dimitar Mar 28 '19 at 14:21
  • Hi Dimitar, I have seen reference to this word. I have researched, but don't know how/what to fix to make my assembly 'strong-named'? The instructions from MS say use the properties 'Signing' to do this. Interestingly, my Click-Once application does not have anything signed and it does not give the warnings? – Turtle1363 Mar 28 '19 at 14:25
  • Are you sure the foreign assemblies are 'strong-named' ? – Dimitar Mar 28 '19 at 14:35
  • I don't know? I don't have access to the foreign assemblies. They are from nuget. They don't seem to be giving errors in the other WPF Click-Once application? – Turtle1363 Mar 28 '19 at 14:54
  • Possible duplicate of https://stackoverflow.com/questions/3487001/assembly-does-not-allow-partially-trusted-caller – Señor CMasMas Mar 28 '19 at 16:07
  • This is not a duplicate, I linked the same question in my question. That question is about how to allow partially trusted callers – Turtle1363 Mar 28 '19 at 16:10

1 Answers1

1

Have you checked settings in project properties => Security Project properties, security tab

enter image description here

3Dave
  • 28,657
  • 18
  • 88
  • 151
Vladimir
  • 35
  • 6