'The class exists in both dlls' .NET issue - asp.net

I cannot deploy my asp.net 4.5 website because I am getting multiple dreaded "The type 'myClassX' exists in both C:\Users\Me\...\whereItsSupposedToBe\ and C:\Users\Me\AppData\Local\Temp\Temporary ASP.NET Files\root\1randomname\_shadow\2randomname\3randomname\App_web_myClassX.cs.4acf3bb.nommceoi.dll errors.
There are three files involved. MyClasses.cs contains definitions for MyClassB, MyClassC, MyClassD. Page1.aspx and page2.aspx include in their <%page %> tag a src attribute for MyClasses.cs.
I have so far done the following:
cleaned the solution and project
shut down VS12
deleted the root\1randomname directory and emptied the recycling bin
restarted the #^$#ing computer
deleted the offending files, cleaned and built, created new files and
renamed all involved filenames, classes and namespaces (oh yeah, they
all used to be'myOGClassA'....)
introduced dummy variables hoping that would change the dll
deleted the bin and obj directories
added the batch="false" attribute to the compilation element of the
web.config file as mentioned here: ASP.Net error: "The type 'foo' exists in both "temp1.dll" and "temp2.dll"
Something makes me wonder if having two of the aspx files having references to the same src file has something to do with it. But in all the blogs and SO posts Iv seen so far that would result in the conflicts both coming from the temp directories.
Head starting to hurt... Any suggestions?

I have "fixed the problem" but I am not sure why it is fixed.
To recreate the problem:
Create a New Project -> ASP.NET Web Forms Application.
Create a new folder ("Search").
Add the three files from the demo project zip found at Static-Site Search Engine with ASP.NET/C# by craigd (Searcharoo version 1). These files are Searcharoo.cs, SearcharooCrawler.aspx, and Searcharoo.aspx.
Take a look at SearcharooCrawler.aspx. At this point I get the 'exists...' errors. If you still do not see errors, view the project in the browser. The errors seem to appear as you are looking at the .aspx files in VS12.
To fix:
Create a new folder ("Happy_App")
Move Searcharoo.cs to the new Happy_App. This fixes the 'exists...' errors, but now Searcharoo.cs 'can't be found' so...
Delete the 'Src="Searcharoo.cs"' attribute from the top <%paging...%> tag in both aspx files. I believe that this Src attribute is no longer used in ASP.NET 4.5 (I may be wrong)
View in browser and navigate to the Search/SearcharooCrawler page. No errors! (need to add a few properties in web.config to get the searcharoo demo working, but thats not the point of this post...)
But the truly weird part - I found that after moving the Searcharoo.cs file to the Happy_App folder I could move it back the original Search folder without any 'Exists' problems!
Why??
If anyone has an explanation that would be awesome. But for now I'm happy I could get a resolution without sacrificing a small animal...

Related

How to include dependent projects XML-comment files during a publish?

When I use the "normal" "Publish-tool" built into Visual Studio for ASP.net, it seems like it does not include XML-comment-files that belongs to dependent projects/assemblies.
For instance, lets say we have two projects:
Presentation = The Web-application
Definitions = A project
containing definitions of models
The presentation-project has a dependency to the Definition-project.
The presentation-project has XML-comments enabled, and so does the Definition-project (for all configurations).
The presentation-project has a few comments added to the actions of its controller(s).
The definition-project has a few comments added to the properties of the model(s).
The expected result would be that when I publish the Presentation-project, we should end up with two XML- files in the bin folder:
Presentation.xml
Definitions.xml
The names might of course alter if any other name has been specified in the build-properties of each project.
The actual result is that only Presentation.xml is published to the bin-folder.
I have tried to link resulting Definitions.xml-file to the Presentation-project as setting it as "Content" and to always copy, that ended up in the file getting copied to the root-folder of the application during a publish and not the /bin-folder.
I have tried the same thing but linked it into the bin-folder of the Presentation-project, but that ened up with the result of the Definitions.xml-file ending up at /bin/bin/Definitions.xml.
I have tried linking and setting Always, but that did nothing.
Here is a simple sample that can be used to reconstruct the problem:
https://github.com/Inx51/publishdemo
However.. one thing to notice is that the Definitions.xml-file is indeed copied to the /bin-folder during build, but its not copied once using publish.
Anyone that has a workaround for this strange behaviour?
Edit your project XML file, .csproj/.vbproj, and include this in the first PropertyGroup:
<ExcludeXmlAssemblyFiles>false</ExcludeXmlAssemblyFiles>
This will include all the .xml of all dependent assemblies.

Using Veeva Vault, how do I connect to a Related Shared Resource?

I'm using Veeva Vault for a project, and I'm unable to get the Related Shared Resource option to work. I'm basically uploading an HTML5 page, and I want to link to a global css file.
This is the Help Guide - http://vaulthelp2.vod309.com/wordpress/applications/promotional-materials-edition/using-clm-integration/
In Veeva, I have a binder presenation, which houses all of my key messages. The key message structure looks like this:
myfilename.zip
myfilename
myfilename.html
myfilename-full.jpg
myfilename-thumb.jpg
assets
css
img
js
I used the Veeva CRM App to get them to display on the iPad. This works fine. I can see my presentation and all of the slides (key messages).
I created a shared folder that looks like this:
[shared]
mysharedname.zip
mysharedname
mysharedname-full.jpg
mysharedname-thumb.jpg
css
img
js
The shared folder is created by Veeva (according to this - https://crmhelp.veeva.com/doc/Content/Print-only_topics/CLM%20Content%20Creation%20Guide.pdf - pg. 70). In Veeva, I added the files as a slide using these options:
Name
Type (Slide)
Country
CLM Properties (Yes)
Product
Renditions
The link to the shared folder in my HTML5 file looks like this:
<link rel="stylesheet" href="../shared/css/main.css">
Once uploaded, I went to the myfilename slide, and checked the Related Shared Resource option, and selected the mysharedname slide. I performed a Force Full Refresh, and synced. The class I set in the mysharedname/css file does not display.
I've tried variations with folder names, added the shared file to the Binder, changed the path of the link to ../shared/mysharedname/css/main.css, etc. with no success.
I've used test.salesforce.com in the past to upload key messages and set shared files. However, I'm unfamiliar with how that's accomplished using Veeva Vault. I'm certain I'm either naming the files incorrectly, or not entering the key message correctly.
Any assistance is appreciated.
Thanks.
It turns out there were two issues. For some unknown reason, the file didn't post properly. Tech support couldn't determine the reason, but suggesting creating a new shared file - which worked!
Also, in posting the new shared file, I noticed the Distribution Package (zip file) keep "disappearing" in the upload process. So, I just re-attached it (in Veeva Vault - INFORMATION > Renditions).
Oh, and the shared file should be outside of the binder.
To link a shared resource in veeva vault please follow the rules for example
./shared/css/base.css
Shared zip structure should be
shared.zip css
base.css
shared_folder_structure
and you need to add the shared resource to the main file perimeter
parameter

Web Resource was not found

I've spent the last day trying to get a checkbox validator to work. I found some starting code on the 4GuysFromRolla website, however this was coded back in 2006 and doesn't play alongside updatepanels.
I've made changes and now it works. As I'd made quite a few changes I wanted to standardise it and use it alongside other utility classes, so I created a new class project and copied the code verbatim.
The problem is that the original works, but I get a WebResource not found error on my new class project.
The differences are: The original was a web application project:
my new project is simply a class library project.
The original assembly and namespace have changed.
Both contain a single class and a resource file (.js)
Both resource files are contained in the root directory
Both resource files are set to embed resource
I'm running out of ideas, and have exhausted the answers I've found on the web with no success.
Is there an issue with the fact that its a class library? Have I perhaps overlooked something else?
Its pretty difficult to see beyond those 2 questions because the project is so small and insignificant.
Here's the code that does work:
if (this.RenderUplevel && this.Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "skmValidators.skmValidators.js");
}
Here's the code that doesn't:
if (this.RenderUplevel && Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "ValidationExtender.EvaluationFunctions.js");
}
Anyone give any ideas?
Thanks in advance.
The error turned out to be a mismatch between the dll's in the test page.

Error in dynamically loaded user controls that reference other controls in different directories

I have the following scenario:
My directory structure is:
./Pages/Page.aspx
./RedControls/RedControl.ascx
./BlueControls/BlueControl.ascx
Page.aspx.cs dynamically creates RedControl:
RedControls_RedControl C = (RedControls_RedControl)Page.LoadControl("~/RedControls/RedControl.ascx");
RedControl.ascx uses BlueControl:
<uc:BlueControl runat="server" ID="ctrControl" />
This works great in development mode, however when I deploy it, I get:
Exception type - HttpParseException - The base class includes the field 'ctrControl', but its type (BlueControls_BlueControl) is not compatible with the type of control (ASP.BlueControls_BlueControl_ascx).
If I move RedControl and BlueControl in the same directory, then it works fine when deployed.
How can I get this to work without having to move files into a single directory (we have too many instances of this).
Any insight would be greatly appreciated.
This could happen in some scenarios where you have multiple folders that have controls that point to each other in both directions (or in more complex situations involving more folders).
The good news is that there is a simple way to solve it: turn off batching by setting batch="false" in the <compilation> section in web.config.

How can I programmatically add build files to Xcode4?

I've been trying to figure out how to programmatically add files to an Xcode4 project and it seemed like AppleScript would be the way to go, however I'm running into "missing value" errors.
Here's the code I've got:
tell application "Xcode"
set theProject to first project
set theTarget to first target of theProject
set theBuildPhase to compile sources phase of theTarget
tell first group of theProject
set theFileRef to make new file reference with properties {full path:"/Users/jeff/Projects/XcodeTest/XcodeTest/MyViewController.h", name:"MyViewController.h", path:"XcodeTest/MyViewController.h", path type:group relative}
add theFileRef to theProject
end tell
--tell theBuildPhase to make new build file with properties {build phase:theBuildPhase, name:"MyViewController.h", file reference:theFileRef, target:theTarget, project:theProject}
end tell
I've tried the commented-out line instead of the add-command as well, but that doesn't work either (I get "missing value").
The 'add' error is:
error "Xcode got an error: file reference id \"251AD3431432472E006E300F\" of Xcode 3 group id \"251AD32C14324645006E300F\" of project \"XcodeTest\" of workspace document \"XcodeTest.xcodeproj/project.xcworkspace\" doesn’t understand the add message." number -1708 from file reference id "251AD3431432472E006E300F" of Xcode 3 group id "251AD32C14324645006E300F" of project "XcodeTest" of workspace document "XcodeTest.xcodeproj/project.xcworkspace"
The "make new reference" does add the file to the list of files in Xcode, but I also need it to be added to the project target so that I can add actions and outlets to the file from Xcode w/o having to first check the checkbox to add it to the "target membership".
I ended up sending this question to the devs on the xcode developer list and the response I got was effectively "you can't".
This appears to be completely broken in Xcode4, but I've seen a project that does it. I think what they are doing is parsing and modifying the "project.pbxproj" file directly. (this file is hidden inside the xcodeproj bundle)
The file is a GUID soup, but once you look at it for a while it seems possible to safely modify it, especially if you are only adding stuff.
Edit:
Found this stackoverflow answer that might help.
Tutorial or Guide for Scripting XCode Build Phases
There is a poorly documented user defined build setting that can be added. Files can be both excluded and included from compilation
Go to your target's Build Settings > Tap the + button > Add User-Defined Setting
The key is either INCLUDED_SOURCE_FILE_NAMES or EXCLUDED_SOURCE_FILE_NAMES
The value is a space separated list of file paths
See reference:
http://lists.apple.com/archives/xcode-users/2009/Jun/msg00153.html

Resources