Why do I keep getting 'Assembly must be specified for XAML files that are not part of a project' errors in a local project? - wpf

To start with, I would like to stress that I do know how to define XML Namespaces correctly in my XAML files. This repeated error is not caused by an mistake in my code. The problem does not stop my project from being built successfully, or running and the mentioned Converter class works perfectly.
When I build the project, the errors disappear. However, the designer show the familiar error message:
When I click on the 'Reload the designer' link, the errors return. The worst part of this problem is that I lose all Intellisense on these views.
The error highlights these namespaces:
But you can clearly see that they have been declared correctly:
I'm sure that I have found a solution for this problem before, but after an extensive search just now, I can only find a million posts relating to this error where users have actually made errors. Please also note that this was a brand new WPF Application and not downloaded from the internet or a network drive.

Is the project ON a network drive? XAML has issues with projects stored on a network drive. In corporate environments your Documents are often remapped to a network path, causing this problem for the default project folder.
Try like c:\projects\yourprojecthere instead?
WPF Project on a network share with clr-namespace

Related

SQL Server Database Project dbml file is always modified [duplicate]

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even when I've made no changes to the project!
I'm not sure if the changes are triggered by building my solution (which also includes an ASP.NET MVC application and a unit test project) or by simply opening the DB project, but this is getting kind of annoying and is creating clutter in source control.
Is it possible to stop these changes from occurring, or get rid of the .dbmdl file whatsoever?
If you delete the .dbml file, it is rebuilt without errors or warnings, so I think it's just a cache file for references, intellisense, etc. I'm going to exclude it from source control.
I believe Visual Studio serializes the dbmdl file every time the project is opened. The only possible work around would be to keep the project open.
See related question here. The .dbmdl file is unique per user (and some kind of cache, as said above) and so the right solution is indeed to exclude it from source control.

asp.net pages can use class library but site won't compile

I am using VS2012 Update 3 and have a solution containing three visual basic projects a class library, a conosole app, and an IIS website.
The website has a reference to the library project. The library compiles fine and automatically places the latest dll in the bin folder of the website.
This was all working without issue before this week.
My web pages are able to import and use the class library. I get proper intellisense and the pages browse or eventually browse showing they are using the library. This week sometimes I get a type not defined error with browsing but after waiting it works. But the compile is always a fail now.
When compiling sometimes the errors show in the error list then eventually disappear but at ALL times when building the errors show up in the output tab as:
SomeCodeBehindFile.aspx.vb(#,#) error BC30002: Type 'SomeTypeInMyLibrary' is not defined.
Error BC30002 - Type XXX is not defined did not help. I tried using fully qualified variable types versus using the import. I tried changing the identity on the app pool to Network Service which has read permission on the whole site.
I've also tried Visual Studio's build > Clean Solution and deleting all files from windows' framework Temporary ASP.NET Files.
The only thing I may have done to irritate VS would have been renaming one of my asp files and its class names/page directive attributes manually but I have done this before without issue. I got paranoid and deleted that file and re-added it also. I also have 3 pages complaining about types not being defined now.
Was really perplexed for awhile. It also got worse with the pages using the library permanently refusing to browse. Though if I copied the library and erroring pages in another web app it would work! Not knowing what went off the rails I started a fresh VB web site and was back in business for awhile but then it started again. I did not connect what I did that actually caused the grief in my 2nd site. For a 3rd time I started a fresh web site this time using C#. Going great again up until that point I kept shooting myself. Thankfully the C# compiler gave a more helpful error message: "A using namespace directive can only be applied to namespaces; 'StaffPlusLibrary' is a type not a namespace". Grrr the problem was I kept adding a help page to the site related to the class library and called the page StaffPlusLibrary.aspx. I am careful not to name pages the same as existing classes but it did not register in my mind I was about to create a page using the same name as my library's root namespace. So the page created a class using the same name as the namespace. The ambiguity I introduced was not apparent until C#.

Stubborn Silverlight Caching Issue?

Bear with a bit me before jumping straight to the normal caching fix solutions. Here's what happening:
I have a project, a single project out of dozens in our solution that appears to be refusing to update its code when I build and run. It's not part of the xap, but a dll sitting along side the xap.
Things I've already determined not a solution:
I've checked the output of its dll and it has been built, and its contents updated to match my code, verified with dotPeek. But it refuses to display the updated code.
I clean, rebuild the solution, and restart the dev server but it refuses to display the updated code.
I switch to a different browser, no dice.
I clear browser cache's to no avail.
I completely delete my local code and do a fresh fetch from our repository, again, no love from silverlight.
I have not been without a little success though. The ONE bone I've been thrown was over the weekend. Not touching it for a couple days, I came back to work on Monday and, without having done anything to it, it just updated. Now, however, it's cached again, or something, because it's stuck in the last set of changes I made to it.
So my question is this: What am I missing?
Most likely your files may be read only and MS Build fails to display error message and it does not update files. In case if you have mistakenly checked in your .xap files, then this is possible, you will have to remove it from your source control and also make .xap file writable by removing readonly checkbox.
Visual Studio checks in your .xap files by mistake and silverlight build does not report any error.
Second, do you have any other file backup service installed like Shadow copy or Dropbox kind of online backup service, something is probably making xap files readonly and that is causing this problem.
Here there are couple answers: Prevent Silverlight 3 from caching while debugging
Code below helped me(add this to Page_Load of page that hosted the app ):
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-100));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
UPDATE:
Prevent Silverlight xap from being cached by proxy server
"So my question is this: What am I missing?"
An internal caching mechanism that our application uses. So, none of you could really have helped me as it was an architectural feature of our software.

Some problems with basic DotNetNuke localization methods

I'm writing a simple DNN module - using DNN 5.6.1 and currently just working direct in a VB.Net source file within the DesktopModules subfolder of a DNN website.
To localize an error message within the module, I'm trying to use:
Dim baseString As String = Localization.GetString("CoveringErrorMessage", Me.LocalResourceFile)
However, this is currently returning "Nothing". Even though Me.LocalResourceFile seems to point to the correct path - /DesktopModules/MyModule/App_LocalResources/MyModule - where MyModule.ascx.resx resides, and even though "CoveringErrorMessage" is defined.
I've also checked that I can definitely edit the resx files from the Admin Language editor.
Beyond this, I've also got a problem with AddModuleMessage() not showing any message - so I'm wondering if there's some obvious setup step I've missed.
All ideas appreciated - this is just one of those frustrating things at present.
It'll look for CoveringErrorMessage.Text rather than just CoveringErrorMessage. Where there's not a . it adds .Test to the resource key.

Why does my DB project's .dbmdl file change even when I make no changes to the project?

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even when I've made no changes to the project!
I'm not sure if the changes are triggered by building my solution (which also includes an ASP.NET MVC application and a unit test project) or by simply opening the DB project, but this is getting kind of annoying and is creating clutter in source control.
Is it possible to stop these changes from occurring, or get rid of the .dbmdl file whatsoever?
If you delete the .dbml file, it is rebuilt without errors or warnings, so I think it's just a cache file for references, intellisense, etc. I'm going to exclude it from source control.
I believe Visual Studio serializes the dbmdl file every time the project is opened. The only possible work around would be to keep the project open.
See related question here. The .dbmdl file is unique per user (and some kind of cache, as said above) and so the right solution is indeed to exclude it from source control.

Resources