NancyFX and adding another project as reference doesn't work - nancy

I created a nancyfx iis host solution from the nancyfx templates. I was wanting to put my domain in a separate project but found that adding that project to the nancyfx project resulted in a the yellow exclamation point beside of the reference and at compile time I was getting errors about the reference to the namespace.
I likely have overlooked something very simple but I can't figure out why this is happening. (I may be able to compile the domain project and add the dll reference but I prefer to just reference the project.)

This doesn't sound like a Nancy issue - are you sure both projects are targeting the same version of the .net framework?

Related

How to compile source of Core and Service on WinRT?

We are trying to make the control panel service working on WinRT. However, we could not compile the code because we cannot find the namespace 'ajn'.
What we have done is:
Download the core source and the service source from AllJoyn website.
Setup a C++ uwp runtime component project and include all those source.
Add C++ wrapper codes to use the control panel service.
Setup another uwp blank app project, so it could use the wrapper codes to utilize contorl panel service.
However, we got stuck on compiling the codes, because the compiler could not find the all those classes under namespace ajn.
Where could we find the namespace? Or did we use the wrong source?
Thank you!
EDIT:
We managed to find those file, However, some linking errors shown up. Is there any good document which shows making codes process for WinRT? Or is WinRT Code Generation is well configured at all? Thanks!
Actually, the files are all in alljoyn_core folder, now the codes have been compiled.
However, some linking errors shown up. Is there any good document which shows making codes process for WinRT? Or is WinRT Code Generation is well configured at all? Thanks!
Just follow the Documentation on the Allseen Alliance's website. here is the link for the building Windows
Building on Windows
Just make sure to follow the steps after creating a new project in Visual Studio
Make sure you set the envionment variables correctly and avoid spelling mistakes. The spelling mistake cost me two to three days in finding the linking error.!

How to set up DotNetNuke for development

I am part of a team of .NET developers and we're trying to use the DNN platform as a way to have a website template so that we will not have to spend weeks or months building core functionality, such as authentication, permissions, navigation, etc. However, I'm very confused as to how the platform works as well as how it's installed. I'v spent many hours researching online at http://www.dnnsoftware.com/ as well as other sites, which only added to my confusion. Here are some specific questions which are still unanswered:
Do we install the source code or not? http://www.dnnsoftware.com/wiki/how-to-install-the-source-package-of-dotnetnuke says that it's not recommended to install source code. On the other hand, http://www.dnnsoftware.com/wiki/packages says that we should use the source code if we are developers (which we are).
If we don't use source code, how do we write code which will be used to add functionality, style, or business logic to our site? Where exactly do we put this code?
I keep on seeing the term "module" being thrown around. What in the world is a module?? Is it a separate .csproj file? Is it a .cs file saved as part of the website? If so, how would we incorporate it without the source code?
Like any other application, we need to be able to maintain full control of builds and deployments. With this, we can see history of what we did, roll back changes if necessary, etc. Currently, for our other projects, we build with TeamCity and deploy with OctopusDeploy. Where does that fit into working with DNN without source? I also know that DNN is set up as a web site project not a web application project (see here http://www.dnnsoftware.com/forums/threadid/338902/scope/posts/threadpage/1) and web site projects is a technology not really being maintained by the newer versions of Visual Studio, and may be harder to deploy as well. Assuming I DON'T want to convert (http://blogs.msdn.com/b/webdev/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx), how would I build/deploy the web site project?
http://blogs.msdn.com/b/webdev/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx seems to state that it's not recommended to remove dependencies from DNN and replace them with other ones. If that's really true, it makes the whole platform seem very fragile and makes me wonder if I'm using the wrong tool altogether. Was DNN really meant for developers or not? (And if not, what was then intended use?)
Start here->
http://www.christoc.com/Tutorials/All-Tutorials/aid/1
1) Don't touch the DNN source, trust me, it isn't worth the headache
2) You add functionality, override style, etc, through the use of Extension (modules and skins)
3) A separate CSProj (check out my templates http://www.christoc.com/Tutorials/All-Tutorials/aid/2
4) You will deploy by taking the ZIP file from each extension and either uploading through the host/extension page, or taking the ZIp file and putting it into /install/module/ in the root of your deployment target, then have a process call /install/install.aspx?mode=installresources
5) DNN is for sure meant for developers, but it is a framework, build on the framework, don't go in and start jacking the framework itself.
I would start by getting a DNN site running on your local. This is fairly straight forward for any .NET developer.
A module is an extension for the DNN framework that you can essentially (once correctly installed) drop on a DNN page (referred to as tab). All your business logic will go in your own modules and the code for these modules will be the only things that you will have to source control. Do not make core changes to DNN as they will be blown away if you ever upgrade.
You do not need to use Christoc's module template if your module will only need to be deployed once. I find that it brings in a lot of unnecessary components and references that you probably will not need. Create your module's using webUserControls that inherit from DotNetNuke.Entities.Modules.PortalModuleBase. Drop the .ascx file in its own folder under DNN's DesktopModules folder and all required .dll's in DNN's bin folder. In DNN, go to Host>Extensions and create a new extention. To the extension add a module control and add your ascx files as controls (leave your default view's key blank). Other views should have unique keys and you can navigate to them in DNN using EditUrl("KeyName").
Drop your module on a DNN page and go from there.
This is of course an over simplification but it should get you going. There are many tutorials online that I advise you watch to learn the basics like Globals.NavigateUrl() to navigate between tabs and how DNN is put together. This forum topic might assist you http://www.dnnsoftware.com/answers/dnn-7-module-development-step-by-step-tutorial

The name does not exist in the namespace error in XAML

Using VS2012 working on a VB.NET WPF application. I have a simple MusicPlayer tutorial app I am using to learn WPF. I am converting a C# version of the tutorial to VB.NET step by step.
It has 2 classes in the app that are both under the same namespace. I am able to reference the namespace in the XAML but when I try to reference the class object in XAML I get an error and I am not able to compile.
Strange thing is that the IntelliSense works fine with both referencing the namespace via the xmlns:c= tag and also when typing the class object using <c:
But the object is underlined and errors are generated trying to build or work in the designer.
The .vb class files are in a folder called \Controls. The Main project Root Namespace is intentionaly left blank. The class is coded like this...
Namespace MusicPlayer.Controls
Public Class UpdatingMediaElement
.... code here
End Public
End Namespace
The xaml looks like this
(namespace defined in the <Window > tag
xmlns:c="clr-namespace:MusicPlayer.Controls"
(object defined in a <Grid> )
<c:UpdatingMediaElement Name="MyMediaElement" />
(error displayed)
The name "UpdatingMediaElement" does not exist in the namespace "clr-namespace:MusicPlayer.Controls".
Not sure what is wrong or how to fix it?
When you are writing your wpf code and VS tell that "The name ABCDE does not exist in the namespace clr-namespace:ABC". But you can totally build your project successfully, there is only a small inconvenience because you can not see the UI designing (or just want to clean the code).
Try to do these:
In VS, right click on your Solution -> Properties -> Configuration Properties
A new dialog is opened, try to change the project configurations from Debug to Release or vice versa.
After that, re-build your solution. It can solve your problem.
If the assembly is different from the namespace in which your class is contained, you have to specfiy it explicitly.
ex:-
xmlns:Local="clr-namespace:MusicPlayer.Controls;assembly=MusicPlayer"
In my case it was because of other compile errors. When other errors have been solved this seemingly related error was also removed from the list. Specially the errors at the bottom of the errors list and on pages you have recently changed.
So do not pay attention to this error directly and focus on other errors at first.
I've seen this issue go away by clearing the Xaml Design Shadow Cache. I had the issue with Visual Studio 2015 Update 1.
In Visual Studio 2015 the Cache is located here:
%localappdata%\Microsoft\VisualStudio\14.0\Designer\ShadowCache
Process:
Right-Click on the solution in the Solution Explorer and Choose "Clean Solution"
Shutdown Visual Studio
Delete the ShadowCache folder
Reopened the Visual Studio project
Rebuild the solution
And voila no more namespace errors.
Try changing the build target platform to x86 and building the project.
I noticed via Subversion that I apparently changed the project build Platform target to x64. This was the only change I had made. After making that change, the code was working for a short while before it started showing the same error you experienced. I changed the platform target to x86 to test and suddenly my designer was working again. Subsequently, I changed it back to x64, and the problem has disappeared completely. I suspect that the designer builds some kind of cached code in x32 and changing the x64 build platform breaks it when you make code changes.
Maybe another solution for when the project compiles but the XAML error is showing :
In solution explore, on the project node that contains the xaml
Right-click on the project and choose 'Unload Project'
Right-click on the project and choose 'Reload Project'
Make sure that your project is still choosen as "startup project". If not :
Right-click on the project and choose 'Set as startup project'
No need to rebuild, or close visual studio.
Jesus... This is still a problem five years later in Visual Studio 2017. Since I'm new to WPF, I was sure the problem was somehow me, but no, everything compiled and ran correctly.
I tried rebuilding, cleaning and rebuilding, switching between x86/x64 output, rebooting Windows, cleaning the ShadowCache folder, adding ";assembly={my main assembly name}" to the XML namespace declaration, nothing worked! The single thing that did:
Put my static class of Commands (in my case the deal was about making the design discover my WPF Commands) in its separate assembly and changing the assembly name to that one's instead.
Dunno if this will help anyone else
I'm new to WPF and still a novice with VB.net - so I was assuming that getting this error was being caused by me doing summit silly........ suppose I was really! I've managed to get rid of it by moving my project from a shared drive to one of my local drives.
Error's disappeared, project compiles perfectly no further issues - yet. Looks like VS2015 still has problems with projects held on a shared drive.
I had this problem recently using VS 2015 Update 3 for my WPF project in .NET 4.6.2. The copy of my project was in a network folder, I moved it locally and that solved the problem.
This may solve other sort of problems, as it looks like VS 2015 doesn't like network paths. Another issue that is a big problem for them is syncing git repositories if my project is in a network path, also solved by moving it locally.
I went through all the answers and none helped me. Finally was able to solve it by myself, so presenting the answer as it might help others.
In my case, the solution had two projects, one containing the models (say the project and assembly name was Models) and another containing the views and view models (as per our convention: project, assembly name and default namespace were Models.Monitor). The Models.Monitor referred Models project.
In the Models.Monitor project, in one of the xaml I included the following namespace:
xmlns:monitor="clr-namespace:Models.Monitor"
I suspect that MsBuild and Visual Studio then were erroring out as they were trying to find a 'Monitor' type in the assembly 'Models'. To resolve I tried the following:
xmlns:monitor="clr-namespace:Models.Monitor;assembly=" - which is valid if the namespace is in same assembly as per https://msdn.microsoft.com/en-us/library/ms747086(v=vs.110).aspx
also tried the explicit namespace declaration:
xmlns:monitor="clr-namespace:Models.Monitor;assembly=Models.Monitor"
Neither of the above worked.
Finally I gave up, and as a work around moved the UserControl I was trying to use to another namespace: 'ModelsMonitor'. I was able to compile fine after that.
I'm also having a lot of trouble with this one! Intellisense helps me complete the namespace and everything, but the compiler cries. I've tried everything I found in this and other threads. However in my case what helped in the end was writing something like this:
xmlns:util="clr-namespace:LiveSpielTool.Utils;assembly="
Leaving the assembly name empty. No idea why. But it was mentioned here. I must add I am developing an assembly, so the assembly attribute might make sense. But entering the assembly name did not work. So weird.
I had the same problem , and in my case the the Markup Design View asked me to rebuild the solution and did not show me the form layout with this message:
Design view is unavailable for x64 and ARM target platforms, or Build the Project to update Design view.
It does not get solved by rebuilding the solution (neither the design view nor the "The name does not exist in the namespace" error)
I think it was because I had played with the settings on Solution -> Properties > Configuration Properties
I finally resolved the problem with 2 jobs:
Checking all check boxes on Build Column of the page: Solution -> Properties -> Configuration Properties
Changing the solution configurations from Debug to Release or vice versa.
I think it's a bug in Visual Studio2012 Update 2.
The same problem plagues Visual Studios 2013, Service Pack 4.
I also tried it with Visual Studios 2015 Preview with the same results.
It's just a limitation of the WPF visualizer which the Visual Studios team hasn't fixed.
As proof, building in x86 mode enables the visualizer and building in x64 mode disables it.
Strangely enough intellisense works for Visual Studios 2013, Service Pack 4.
In my case the problem was due to some phantom files under the project's obj directory. The following fixed the issue for me:
Clean project
Exit VS
rm -rf /obj/*
Invoke VS and rebuild
In my case, it was just a weird bug.
I had the class I was trying to use in my namespace however Visual Studio kept throwing an error saying the class did not exist in the given namespace.
What I did to fix it was really silly but worked like a charm.
I commented out all the lines of code where I was trying to use the class, cleaned the build, rebuilt and the project was up and running.
Then I just uncommented the lines of code I had commented earlier and well, Visual Studio was no longer throwing me any errors.
Rebuild again and you are ready to go.
Looks like this problem may be solved through a variety of "tricks."
In my case, I had been building/rebuilding/cleaning the entire solution, instead of just the project that I was working on within the solution. Once I clicked "Build [my project]," the error message went away.
Try verifying your assembly references. If you have a yellow exclamation mark on the project references there's a problem there and you'll get all kinds of errors.
If you know the project reference is correct, check the Target framework. For instance, having a project using the 4.5 framework reference a project with 4.5.2 framework is not a good combination.
The solution for me was to unblock the assembly DLLs. The error messages you get don't indicate this, but the XAML designer refuses to load what it calls "sandboxed" assemblies. You can see this in the output window when you build. DLLs are blocked if they are downloaded from the internet. To unblock your 3rd-party assembly DLLs:
Right click on the DLL file in Windows Explorer and select Properties.
At the bottom of the General tab click the "Unblock" button or checkbox.
Note: Only unblock DLLs if you are sure they are safe.
In my case, the user control was added to the main project. I tried various solutions above to no avail. Either I would get Invalid Markup but the solution would compile and work, or I would add the
xmlns:c="clr-namespace:MyProject;assembly=MyProject" and then the markup would show, but I would get a compile error that the tag does not exist in the XML namespace.
Finally, I added a new WPF User Control Library project to the solution and moved my user control from the main project into that one. Added the reference and changed the assembly to point to the new library and finally the markup worked and the project compiled without error.
In my case I had a namespace and class spelled exactly the same, so for example, one of my namespaces was
firstDepth.secondDepth.Fubar
which contains its own classes (e.g. firstDepth.secondDepth.Fubar.someclass)
but I also had a 'Fubar' class in the namespace
firstDepth.secondDepth
which textually resolves to the same as the Fubar namespace above.
Don't do this
This problem can also be caused if the assembly that you're referencing isn't actually built. For example, if your xaml is in Assembly1 and you're referencing a class also in Assembly1, but that assembly has errors and isn't building, this error will be shown.
I feel silly about it, but in my case I was tearing asunder a user control and had all sorts of errors in the related classes as a result. As I was attempting to fix them all I started with the errors in question, not realising that xaml relies on built assemblies to find these references (unlike c#/vb code which can work it out even before you build).
I get this problem all the time. My views are in a WPF Custom Control Library project (a variant on Class Library). I can reference pre-built assemblies, but cannot reference any code in another project of the same solution. As soon as I move the code to the same project as the xaml it's recognized.
This happened to me already twice in a complex WPF app, in it there are 4 multi platform projects, 1 shared project, 2 support libraries, and 1 test project..
This very specific XAML namespace error happened twice on very recently modified files on the Shared project. In both of my cases, it was a new c# file added with a repeating namespace entry;
Like namespace MyProgram.MyFolder.MyProgram.MyFolder
I double pasted it once by mistake, and once it was due to JetBrains Rider double pasting the namespace. (If you ever rename a project in Rider, it time to time starts double pasting namespaces on new file creations, especially on Shared projects..). These c# files with repeating namespaces were then called in the ViewModels where XAML files were referencing to. Well you then get these unrelated and misleading errors, you can have a problem with one file, all your Xaml files will start erroring out eventually.
Anyways, if you get these kind of errors, it's most of the time an issue on a very newly added file or code change. My suggestions would be to look at your very recent changes.
If non of the answers worked
For me was .Net Framework version compatibility issue of the one i'm using was older then what is referencing
From properties => Application then target framework
VB.NET does not automatically add the Namespace information based on the folder structure as it does in C#. I think I am going through the same tutorial as you (Teach Yourself WPF in 24 Hours), and doing the same conversion to VB.
I found you have to manually add the Namespace information to Both the XAML Class and the XAML.VB code behind to be able to use the Namespaces as described in the book. Even then, VB doesn't automatically Assign the Namespace to the Assembly as it does in VB.
There is another article here that shows how to include this in your project templates so it does build the Namespace information automatically - Automatically add namespace when adding new item
In the solution property page, check the platform of the assembly that contains "UpdatingMediaElement" and the assmeblies that contain any of the superclasses and interfaces from which "UpdatingMediaElement" subclasses or implements. It appears that the platform of all these assemblies must be "AnyCPU".
Another possible cause: A post-build event is removing the project DLL from the build folder.
To clarify: WPF designer may report "The name XXX does not exist in the namespace...", even when the name does exist in the namespace and the project builds and runs just fine if a post-build event removes the project DLL from the build folder (bin\Debug, bin\Release, etc.). I have personal experience with this in Visual Studio 2015.
Ok, so none of these tips worked for me, unfortunately. I was able to eventually solve the issue. It seems that Visual Studio does not play nicely with network drives. I solved this issue by moving the project from the shared drive to my local and recompiled. No more errors.
Adding to the pile.
Mine was the assembly name of the WPF application was the same assembly name as a referenced dll. So make sure you don't have duplicate assembly names in any of your projects.
I had the solution stored on a network share and every time I opened it I would get the warning about untrusted sources. I moved it to a local drive and the "namespace does not exist" error went away as well.

Adding link to Web Reference from a Project - ChannelBase not found

I am building a Silverlight app. As I have classes to be consumed by Silverlight and .NET modules, I have created a Silverlight project with all the classes in it and then, a .NET project linking('Add Link') to the classes in Silverlight project. This way, I have one class file compiled separately as Silverlight and .NET assemblies. I want to replicate the same for web service references. Meaning, I have web references in the Silverlight project. I am trying to 'Add Link' to reference.cs from Silverlight project into the .NET project. When I compile the .NET project, the ChannelBase class doesn't get resolved it seems due to disparity in definition of the class in Silverlight and .NET framework libraries. This results in compilation error stating unresolved ChannelBase. Sounds like a dead end to me. Do you see a way around this problem?
I'm afraid this is not possible. Both proxies are completely different: one of them is synchronous while the other one is not.
The best thing you can do is to share the service defined classes, not the whole proxy. Just create those classes beforehand, use "Add as link" to reuse them in both projects, and then when you add the service reference, mark the option "Reuse types in referenced assemblies".
Just in case someone else stumbles on this. I had a similar problem. I was generating the proxy using slsvcutil.exe and trying to compile it for .net and monotouch. I kept getting ChannelBase not found. Which made no sense at all. Finally I commented out the CookieContainer property in the proxy client class and low and behold the compile error went away and the proxy works for monotouch.

Is the System.Web.Silverlight reference needed?

We are just getting into Silverlight development at my workplace. Somehow two of our dev machines have been configured differently. I noticed that one of them has access to System.Web.Silverlight in the reference list, and the other doesn't. Both can create and run Silverlight applications from scratch.
What does System.Web.Silverlight do? Is it a legacy reference? If we need it, where do we get it from?
This dll provided the ASP.NET Silverlight server control which was designed to make it easier to create the object tag needed to describe the silverlight plug-in.
This server-side control was removed as of Silverlight 3, you are now expected to build the object tag yourself.
So yes its legacy so you don't need it.
Anthony is correct. If you are having trouble after you upgrade your products to Silverlight 3 - or just want an example on how to insert your SL app in to a page, create a new SL3 project and check out the sample ASPX and HTML pages (which are pretty much the same as each other now...)

Resources