Questions tagged [.net-assembly]
A group of classes and namespaces compiled into a binary file, written in a .NET-specific language such as C# or VB.NET.
.net-assembly
3,362
questions
502
votes
22
answers
262k
views
Practical uses for the "internal" keyword in C#
Could you please explain what the practical usage is for the internal keyword in C#?
I know that the internal modifier limits access to the current assembly, but when and in which circumstance should ...
327
votes
7
answers
23k
views
What is the purpose of a stack? Why do we need it?
So I am learning MSIL right now to learn to debug my C# .NET applications.
I've always wondered: what is the purpose of the stack?
Just to put my question in context:
Why is there a transfer from ...
271
votes
14
answers
210k
views
How do I find the PublicKeyToken for a particular dll?
I need to recreate a provider in my web.config file that looks something like this:
<membership defaultProvider="AspNetSqlMemProvider">
<providers>
<clear/>
<add ...
267
votes
37
answers
535k
views
Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. Manifest definition does not match the assembly reference
Things I've tried after searching:
in Web.Config put a binding on the old version:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture=...
217
votes
6
answers
174k
views
How can I get the executing assembly version?
I am trying to get the executing assembly version in C# 3.0 using the following code:
var assemblyFullName = Assembly.GetExecutingAssembly().FullName;
var version = assemblyFullName .Split(',')[1]....
162
votes
6
answers
64k
views
Best practices/guidance for maintaining assembly version numbers
I'm looking for pointers, suggestions, and even dictation on how to manage the three different assembly version numbers for a .NET assembly. The Product version is the simplest, as this seems would ...
119
votes
5
answers
306k
views
How to view the Folder and Files in GAC?
I want to view the folders and sub folders in GAC. Also want to know about adding and removing from GAC.
To install we write this lines in command prompt by opening Visual Studio command prompt:-
...
118
votes
5
answers
47k
views
How to prevent ReflectionTypeLoadException when calling Assembly.GetTypes()
I'm trying to scan an assembly for types implementing a specific interface using code similar to this:
public List<Type> FindTypesImplementing<T>(string assemblyPath)
{
var ...
109
votes
23
answers
175k
views
No assembly found containing an OwinStartupAttribute Error
This error
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The given type or method 'false' was not found. Try specifying ...
90
votes
21
answers
257k
views
Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues
I have found plenty of information out there about this error: 'ERROR: Could not load file or assembly '*.dll' or one of its dependencies. Access is denied.’
But i haven't found answer specific to my ...
78
votes
11
answers
107k
views
Could not load file or assembly HRESULT: 0x80131515 (When adding controller to MVC project that has assembly references on network drive)
I've seen this: VSTS 2010 SGEN : error : Could not load file or assembly (Exception from HRESULT: 0x80131515) and none of the answers work. It also doesn't appear when I build or anything. I can run ...
78
votes
4
answers
60k
views
Shared AssemblyInfo for uniform versioning across the solution
I've read about this technique: Shared assembly info in VS projects - JJameson's blog
Basically it means to create a SharedAssemblyInfo.cs with versioning information about the assembly, and adding ...
70
votes
1
answer
70k
views
Understanding a csproj assembly reference
I am using VS2010 and I tried to add a few assemblies from local hard disk to my C# project through file reference. Peeking into the csproj file, I found sometimes the file reference appears as
<...
62
votes
3
answers
45k
views
How to use "InternalsVisibleTo" attribute with Strongly named assembly?
I am using the "InternalsVisibleTo" attribute with an assembly to expose the internal methods/classes to my unit test project.
I now need to install that assembly into the GAC, so I need to give it ...
60
votes
6
answers
81k
views
From where do I reference a missing assembly (System.Net.Http.Formatting)?
In my Visual Studio 2013 RC project, I'm getting this err msg:
"The type 'System.Net.Http.Formatting.MediaTypeFormatter' is defined
in an assembly that is not referenced. You must add a reference ...
60
votes
6
answers
91k
views
How to check the version of an assembly (dll)?
I have c# application and when I made a change, I am getting the error message:
An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsFormsApplication1.exe
Additional ...
57
votes
7
answers
76k
views
Find out dependencies of all DLLs?
I have a collection of DLLs(say 20). How do I find out all the DLLs on which one specific DLL (say DLL A) is depending upon?
57
votes
1
answer
23k
views
What is the difference between Version and 'Runtime Version' in .Net?
When I open the properties window of one of the referenced dlls in my project in Visual Studio I see a Version and also a runtime version .
Actually it is Rhino.Mocks library I am checking. And I see ...
56
votes
6
answers
277k
views
System.IO.FileNotFoundException: Could not load file or assembly 'X' or one of its dependencies when deploying the application
I'm having a strange problem with deploying an application, which references an assembly, written in managed c++.
I've created an assembly X, compiled it and referenced it in an exe file, called ...
52
votes
3
answers
12k
views
Caching reflection data
What's the best way to cache expensive data obtained from reflection? For example most fast serializers cache such information so they don't need to reflect every time they encounter the same type ...
50
votes
10
answers
21k
views
Resharper runs UnitTest from different location
When I run unit tests with Visual Studio it works fine, because it runs from project directory where all assemblies are. But when I run it with resharper it goes with error on
var services = ...
44
votes
3
answers
24k
views
DLL reference not copying into project bin
Project A references Project B, and Project B references an external DDL (restored using NuGet). The DLL should get copied into Project A's bin folder (along with Project B's DLL):
In my case, when ...
42
votes
5
answers
68k
views
How to get the assembly (System.Reflection.Assembly) for a given type in .Net?
In .Net, given a type name, is there a method that tells me in which assembly (instance of System.Reflection.Assembly) that type is defined?
I assume that my project already has a reference to that ...
42
votes
2
answers
71k
views
How to determine calling method and class name? [duplicate]
I'm currently developing a application logging library using the built in TraceListener. This library will be used in many projects and should offer a simple interface where I only have to care about ...
41
votes
9
answers
106k
views
Exception from HRESULT: 0x80070057 (E_INVALIDARG)
I have a WPF application . While building it I am getting the following error:
Could not load file or assembly or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: ...
40
votes
4
answers
43k
views
How can I see the strong name of my assembly?
I have a project, and I created a strong name key file for it.
How can I tell what the strong name of my assembly is? It seems this should be obvious, but I can't find any reference to it.
39
votes
2
answers
70k
views
How to register a .NET assembly as COM?
I have created a class library for a workflow on a local machine and build that. I moved the complete solution to a Tridion server and tried to register the assembly in the server using regasm.exe ...
38
votes
3
answers
47k
views
Get company name and copyright information of assembly [duplicate]
I am using Assembly.GetEntryAssembly().GetName() to get application/assembly name and its version but I do not see any variable for company name and copyright. How do I get that?
38
votes
2
answers
13k
views
Why does ASP.NET MVC 4 have so many NuGet packages and which are truly important?
As the title says, why do the ASP.NET MVC 4 projects have soooo many NuGet packages? Is the entire framework split into packages now? Which ones are truly important for an empty project that will be a ...
37
votes
9
answers
120k
views
'Could not load file or assembly 'netstandard, Version=2.0.0.0, ...'. Reference assemblies should not be loaded for execution
Goal:
From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type ...
37
votes
3
answers
63k
views
Unable to find type [System.IO.Compression.CompressionLevel]: make sure that the assembly containing this type is loaded
I wrote this PowerShell script to archive all log files created during a certain date range.
$currentDate = Get-Date;
$currentDate | Get-Member -Membertype Method Add;
$daysBefore = -1;
$...
35
votes
5
answers
53k
views
How to add a reference to System.Numerics.dll
I want to use the BigInteger class from the System.Numerics but if i want to write
using System.Numerics;
Numerics is not found. I searched the web, and I found that I have to add a reference to ...
33
votes
5
answers
86k
views
Newtonsoft.Json Assembly Conflict
I use Netonsoft.Json in my project. It works fine until I start integrating Paypal SDK in my Project. My code is as below.
String AccessToken =
new PayPal.OAuthTokenCredential("", "")....
32
votes
3
answers
35k
views
App.config in Test Projects
I'm building an ASP.NET app in VS2010. I have a number of separate assemblies (class libraries) and corresponding Test projects for each.
In one of the class libraries I use an App.config file to ...
31
votes
2
answers
75k
views
How to add PNG resource in Visual Studio 2010?
I have a PNG (i.e. a compressed image) that I'd like to include in my assembly (i.e. application).
How to do it?
Additional information:
I tried adding a PNG resource to my assembly in Visual ...
30
votes
1
answer
39k
views
Get assembly executable directory
I have two applications, e.g. App1 and App2.
When running normally, App1 will show its assembly executable location.
But when I call App1 from App2, it returns App2's startup location.
So, how do I ...
29
votes
4
answers
69k
views
Why AppDomain.CurrentDomain.BaseDirectory not contains "bin" in asp.net app?
I have a web project like:
namespace Web
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lbResult....
29
votes
5
answers
34k
views
Loading plug-in DLL files, "The invoked member is not supported in a dynamic assembly."
We have custom DLL's that are not included in our initial setup file. They are loaded at runtime. This process worked fine while using .NET 2.0, but we are getting the "The invoked member is not ...
28
votes
2
answers
4k
views
Omit localized versions of assemblies from the build output
In one of my projects, I am using an awesome library called Humanizer. This library comes in many language variations (I counted 38).
When I build my project, I then see all these folders like "af", "...
28
votes
2
answers
6k
views
What's the XML file that comes together with a .NET assembly file?
Many .NET assemblies are accompanied with an XML file. For example, System.Web.WebPages.Razor.dll comes together with System.Web.WebPages.Razor.xml that contains the following:
<?xml version="1.0" ...
27
votes
3
answers
23k
views
'AssemblyTitle' attribute in the .NET Framework
What is the practical use of the AssemblyTitle attribute? MSDN says that it specifies a description for an assembly and that the assembly title is a friendly name which can include spaces.
Visual ...
26
votes
2
answers
71k
views
Not allowed to load assembly from network location
I've recently set up a new Windows Server 2012 R2 environment and installed Visual Studio 2012.
Now I'm having a problem with multiple .NET 4.5 project's I migrated from my old server, a Windows ...
26
votes
5
answers
20k
views
Display project version in ASP.NET Core 1.0.0 web application
None of what used to work in RC.x helps anymore.
I have tried these:
PlatformServices.Default.Application.ApplicationVersion;
typeof(Controller).GetTypeInfo().Assembly.GetCustomAttribute<...
26
votes
1
answer
16k
views
Reference Assemblies folder and different assemblies with the same version
I have a project that uses System.Runtime.Serialization assembly. I am using the type DataContractSerializer from that assembly, but I have a problem.
There are two assemblies:
C:\Program Files (x86)\...
25
votes
2
answers
14k
views
Which is better for getting assembly location , GetAssembly().Location or GetExecutingAssembly().Location
Please suggest which is the best to getting executing assembly location.
Assembly.GetAssembly(typeof(NUnitTestProject.RGUnitTests)).Location
or
Assembly.GetExecutingAssembly().Location
Please ...
25
votes
6
answers
18k
views
How to access classes in another assembly for unit-testing purposes?
I'm jumping into unit-testing the Visual-Studio 2008 way, and I'm wondering what's the best way to accomplish cross-assembly class access for testing purposes.
Basically, I have two projects in one ...
25
votes
2
answers
76k
views
"The located assembly's manifest definition does not match the assembly reference"
I have deployed an .NET WebAPI app (compiled against .NET 4.5.2, and running locally) into an Azure App Service.
The error thrown there is
Could not load file or assembly 'System.Web.Mvc, Version=...
25
votes
3
answers
28k
views
How to resolve .NET Core package version conflicts
I am migrating from a .NET MVC 5 Web Application to a .NET Core 2.2 Web API project along with five .NET Standard 2.0 projects all housed under one solution.
I am now receiving 28 warnings (MSB3277) ...
24
votes
3
answers
55k
views
Powershell unable to find type [System.Windows.Forms.KeyEventHandler]
This might be a pretty simple question but I'm totally lost and searching for an answer hasn't been helpful.
I've got some powershell code to display a simple GUI with TextBoxes. Some of the ...
24
votes
2
answers
8k
views
What is Fusion in .NET Assembly
In Suzanne Cook's blog there is such a description:
LoadFrom Context: In general, if the user provided Fusion a path which was used to find the assembly (and the assembly at that
path wouldn't ...