VS2015 - debug my referenced project - debugging

I have a solution using to projects: a class library project, and a console application referencing this. Now when I try to debug the console application, it loads the class library from the GAC, not the version from the "sister project" of the solution. I just have changed one line of code in the class library project, and the debugger now just shows me the disassembly instead of the C# source code for methods in the class library.
How can I get VS2015 to load the assembly version from the sister project, not the version from the GAC?

If the same dll file was in the GAC, it would be loaded firstly, I think it is the reason why it ignored the reference project. So if you really want to use the project reference, you really need to remove the GAC.
Of course, other members also provided the suggestion like using the version numbers:
https://social.msdn.microsoft.com/Forums/en-US/af5086ad-a2b6-4707-b593-0ca4f5518a6a/force-use-of-local-assembly-instead-of-gac?forum=clr

Related

Referencing class library (.dll) from the same VS (2010) solution

recently I have experienced a problem which is really strange. I have a c# VS solution which contains 2 projects: a class library (.dll) and a WindowsForms. I had no issues so far to reference the dll from my WinForms applications. However, now, after I reference it, everything works fine, in terms that while writign code the dll assemblies are recognised, until I try to compile and debug, where the dll is not recognised any more, though it is referenced.
Any help would be apprecited.
Regards,
D.
PS. I have tried both referencing the project and dll...Does that mean that the problem is at the dll?
do you have correct .net target on both sides ?
.net client profile / full .net

Visual studio browse references source?

I remember being able to do this but I must have changed something as I can no longer view an external projects source even though the pdb is with the reference. I can step into external functions when debugging but I can't go to them using "Go to implementation/declaration"
This will work if you have a separate class library Project as a part of your Solution, and you added a reference to the Project, not the compiled .dll.
You cannot step into a .dll when debugging.
It's all in how you add the reference.

Assembly reference not getting updated in the silverlight 4.0 application project

Point 1):
In one solution called CustomBehaviorsSolution, I have two projects - one is class library and another is silverlight class library project. The silverlight class library project has the class files which are 'linked' to the files of the first project. The solution compiles successfully.
Point 2):
I have another solution which has one silverlight application project and another desktop application project. The silverlight application project has the assembly refernce of the silverlight class library mentioned in Point 1 above. The desktop application project has the assembly reference to the class library mentioned in point 1 above.
Now, when I modify or add any class to the project mentioned in point 1 above and update their references in the projects in the solution 2; I experienced some weird behavior.
The desktop application project gets the new changes from the referred assembly whereas the SILVERLIGHT application project does not get the same changes from the referred assembly.
In ILDASM i saw the referred assemblies of point 1 above and they are alright. The problem is that the silverlight application project is not reading the updations from the assembly reference.
Can someone please help?
(I have been removing and then adding the assembly references.)
I'm using VS 2010 and Silverlight 4.0. (After ensuring almost everything, now I think that it might be a bug in VS 2010 or SL 4.0 ! Possible?
I created the new solution altogether (mentioned in point 2) and then added necessary assembly references and now everything is fine.
It seems that the previous solution was corrupted due to some reason.

How can I force Visual Studio to reference an assembly without using its version?

I have a VC++ project and I need to add a reference to a managed dll. This dll has a version number which changes every build. When I add it to my project, its version is saved and if I replace it with another one (with a different version number) the project cannot compile because it doesn't find the dll with the version previously saved.
Is there a way to add a reference without a specific version?
Thank you for your help
The C# IDE has the "Specific Version" property for a reference but the C++/CLI build system doesn't support that. There is a workaround, you can use the #using directive in source code to load an assembly reference. This by design cannot check the assembly version of the reference assembly. Normally that's a problem but not in your case. The MSDN page is here.
Note: I don't know whether this works with C++ projects -- we have C# code that references C++, but we haven't done the other way around. But just in case it's easy, I'll offer this:
With C#-to-C# references, normally you would make sure both projects are in the same solution, and then add a reference using the "Projects" tab of the Add Reference dialog (not the "Browse" tab). This way, the build system has a reference to the project in the solution (which knows its own current version number), rather than having a reference to the filename+version; and then it can cope with version number changes just fine.

How do I use Fluent NHibernate with .NET 4.0?

I want to learn to use Fluent NHibernate, and I'm working in VS2010 Beta2, compiling against .NET 4, but I'm experiencing some problems.
Summary
My main problem (at the moment) is that the namespace FluentNHibernate isn't available even though I've imported all the .dll assemblies mentioned in this guide.
This is what I've done:
1. I downloaded the Fluent NHibernate source from here, extracted the .zip and opened the solution in VS. A dialog asked me if I wanted to convert the solution to a VS2010 solution, so I did.
2. I then went into each project's properties and configured all of them to compile for .NET 4, and built the entire solution.
3. I copied all the .dll files from /bin/Debug/ in the FluentNHibernate to a new folder on my local hard drive.
4. In my example project, I referenced FluentNHibernate.dll and NHibernate.dll from the new folder.
This is my problem:
If I right-click on FluentNHibernate in the References list and select "View in Object Browser...", it shows up correctly.
Now, when I try to create a mapping class, I can't import FluentNHibernate. This code:
using FluentNHibernate.Mapping;
namespace FluentNHExample.Mappings
{
}
generates an error on the using statement, saying
The type or namespace 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?).
The FluentNHibernate assembly is still in the list of References of my project, but if I try to browse the assembly in Object Browser again, it can't be found.
What is causing this?
I also had similar problem.
"Error List" window displayed:
The type or namespace name 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?)
But "Output" window was displaying detailed information:
warning MSB3253: The referenced assembly "FluentNHibernate" could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
In my case; I had created a console application project which was targeting ".Net Framework 4 Client Profile" by default, so changing to ".Net Framework 4" fixed issue for me.
I'm unable to observe this behavior in my build, could it be related to this problem: Weird override problem with Fluent NHibernate and .NET 4
If so you could try http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/ae4013d711d2e4ad as a potential fix.
Isn't there a better way to fix this problem?
I don't want to reference System.Data.OracleClient. So I shouldn't have to target the full .Net framework if I don't even want that reference.
Can't I target the Client Profile of the .Net framework, but add a compiler warning exception somewhere so that it just skips that warning? I know it won't cause a runtime problem because I don't use Oracle.
I get identical problem which says there's also a dependency on System.Web. Same story, this is for a Windows WPF app, so I don't need System.Web. Can't I just target the Client Profile and somehow convince the compiler to keep going?
Thanks,
Hugh
EDIT: I figured this out! I had to compile NHibernate myself though. Opened the 2.1.2 code in Visual Studio and deleted everything that says "Oracle" or "System.Web" and I ended up getting it to build. I do not have to target the full .Net Framework now.
We had this issue and the issue went away if we removed the obj and bin folder from the project which was referencing the NHibernate using project.
So we have 'project1' which uses NHibernate to produce project1.dll.
'project2' references project1.dll.
Problem resolved if we removed the obj/bin folder from project2.
Can't say why, but our solution now compiles fine.
Mike.

Resources