I have a solution that contains to class library projects named "CompanyName.Data" and "ComanyName.Utilities".
If I create another class library project and reference the two projects, everything works fine. If, however, I choose a web app then, despite adding the reference, the other namespaces cannot be referenced in the project.
It's as if I haven't imported the namespace or done the reference at all.
FYI, I'm running VS2012. Any advice? Am I missing something obvious? I'm going to do some more experimenting.
Regards,
Chris.
UPDATE: The issue seems to not be a web app but be when the web app project is named "Company.Something".
For anyone who reads this and thinks the same. This 'feature' is by design. It's a safety measure to prevent clashing against the plethora of namespaces created in a web application. I don't quite understand myself, but that's the official word.
Related
First of all, thanks for the help in advance, and excuse me for my relative lack of knowledge on these subjects, and this long post. I have a strange reference issue I'm trying to work out. I've done many hours of research on this subject, but I think my limited knowledge is holding me back from understanding. I'm losing my mind a bit here.
We are reviewing a project and came across an odd situation where there are references to System.IO and System.Runtime in the original .csproj file for an application (Sitefinity 10.1.6502), but in the copy of the .csproj we have on file post-development they have been removed. There are still references to System.Runtime.Caching and System.Runtime.Serialization in both.
When I looked online and in Sitefinity's public Git example repos, I found that about 1/2 of the examples with code for the same version DO have and like the original file does, and 1/2 DO NOT have them like the file in our repo. Some appear to have those references added at a later time when upgraded versions (to 10.2 or 11).
I also do not see System.Runtime.dll in the current /bin folder, or see it mentioned in web.config. I do not have access to the GAC.
The question is whether these missing references will cause any problems. The project seems to compile properly in VS2017 using the post-development .csproj file we have (without System.IO and System.Runtime)
We believe the project was originally built in VS2015, and found this article that mentions the exact references we're dealing with, so perhaps VS2015 was part of the problem? Unresolved Project References for System.IO, System.Runtime
I understand these are facades and that System.IO is a namespace in System, which is directly references in both .csproj versions, so that should be covered, correct?
The real question is whether the missing in the post-dev .csproj file could cause any issues. Like I mentioned above, the project is compiling without it in VS2017, and the files seem to work fine on a testing server (can navigate the front-end web pages and all functionality works, but we have not been able to test any of the back-end functionality due to it sharing a database with the live environment (out of our control).
Through my research I've seen it mentioned that System.Runtime should get automatically included during tooling/compiling, and that in normal circumstances it does not need to be directly referenced like it is in half the repos we saw. Is this correct?
I worry less about System.IO because it is already included via System, but from what I understand that isn't the case with System.Runtime
Again, thanks so much for helping clear this up for us, we're beginning to go batty trying to figure out if this is an issue we should worry about or not!
Hi fellow programmers,
I'm creating a ControlLibrary for future project's that uses the amazing MaterialDesignXaml library. In this ControlLib I use the MaterialDesignThemes.dll that contains several styled controls, resources and classes.
Now my problem is that I need to use the same dll's in the real application (sae sollution for now). If I want to use the mentioned control library in this project (as project reference) I always get this error:
Dll Error in Application Project
.
I understand the problem the compiler has with this, since It cannot check if two refrences (from seperate projects in the sollution) are the same dll. But how can I fix this?
The strange thing is that the designer complains like in the screenshot, but the application runs just fine...
I'm using TortoiseSVN for Version Management, maybe this has to do something with it?
Any idea's?
I have a solution with 3 projects. I made it as a test:
1) The WinFormsProject (setted as Main project): It is just a form that throws an exception when clicking a button. Before throwing the exception, it makes some assignations with an object of the class Person (who is in another assembly).
2) The ConsoleProject: It's another assembly with the same idea: it only plays a little with an object of the class Person and then throws an Exception.
3) The AspectTest: it's an assembly which has defined the class Person and an aspect (called LogBoundary) (inherited from OnMethodBoundaryAspect) who logs OnEntry(), OnExit(), OnSuccess() and OnException().
The three assemblies are configured through an "AspectInfo.cs" class to target every method but the "CompileGenerated" ones. So:
[assembly: LogBoundary()]
[assembly: LogBoundary(
AttributeExclude = true,
AttributePriority = 0,
AttributeTargetMemberAttributes = MulticastAttributes.CompilerGenerated)]
The problem is that all methods in the assembly AspectTest are being logged, but the ones in WinFormsProject not. I have no idea why.
Some things to consider:
Every assembly has a reference to postsharp. So every aspect is
being correctly recognized by the compiler.
If I set the ConsoleProject as the Main project, it works
correctly. The problems comes only with WinFormsProject.
WinFormsProject references AspectTests (of course!).
ConsoleProject references AspectTests (of course!).
There is no dependency between WinFormsProject and
ConsoleProject.
Any help would be great, and if you still need some info about this, please ask me (I might forget to tell something).
Thanks!
To introduce the aspects into your code, PostSharp needs to execute during build time after the main compilation step. This means that adding a reference to PostSharp.dll in your project is not enough - the build sequence of the project needs to be modified as well.
PostSharp automatically integrates into the build process when you install the NuGet package. If PostSharp doesn't run during build, then you can try to reinstall the package.
Well, I am a bit ashamed of the reason, but it might pass to anyone, so here's the problem and how I solved it.
The problem was: as I added the postsharp.dll as a reference manually and not with NuGet (because I had no internet on that moment) the references were ok, all compiled as expected, but as said, aspects didn't worked on the Winforms project. Maybe I missed to do something else.
The solution, therefore was so easy as to add postsharp through Nuget. Just that.
Now everything works. If someone has a better idea of the description of the problem, it would be good to know it.
thanks, AlexD.
I'm stuck with a project that I can't get "seen" in a reference by other projects in the same solution.
This is the error: Error 2 Metadata file 'C:\Documents and Settings\user\Desktop...\bin\Debug.dll' could not be found.
I've added the reference of course, and added the using directive for the namespace where it's used in class files. I remove the file, save, restart, and start anew, and it persists. Any ideas? I've been searching for hours, and it seems as though this can be caused by many things, none of which pertain to me. :/
It's a simple set of three class libraries and one windows forms project in the solution, VS 2010 Express, C#.
Within the same solution, but not within the same project? Are you sure you've declared your classes as public? They're internal by default.
Is one of your projects using .net 4 Client Framework and the referenced one isn't?
Have you added a project reference or a DLL reference between the projects? IS the name of the assembly you are referencing, really Debug.dll?
This is a little old, but thanks to the advice here I found my problem.
One project was using ".NET Framework 4 Client Profile" and the other ".NET Framework 4". I switched them both to use ".NET Framework 4" and it works fine now.
I'm attempting to follow David Betz' wonderful advice on how to use a library project in both your .NET and Silverlight code. In particular, I'm using his File-Level technique: I have a .NET library project already set up, so I created a Silverlight project, and added links in the latter to the former's files.
Unfortunately, there is a problem. I get compilation errors like crazy, of the form:
The type '...' exists in both 'Util.dll' and 'Util (Silverlight).dll'
In all of my other projects, I only reference one or the other. Neither Util dll has a reference to the other, so I'm not sure why the compiler can see both DLLs from any of the other projects.
Any ideas?
Answer posted by frank in comments. Porting to answer and community wikiing it in hopes that it'll be accepted as the answer.
Comment
Argh! It really was this simple :) I just fixed the compilation issues other then this one, and it suddenly stopped complaining.
I also added to the linked projects Project Dependencies on the real projects, and that helped keep the errors more consistent, at least.
– frank