I have an ASP.NET application that is available in two languages: English by default and Portuguese as second option.
Everything was working good, look this first image:
Then when I try to add or remove a string resource, visual studio starts to give me ambiguity errors when compiling, as those:
The namespace 'VolunteerGames.Web.Translations' already contains a
definition for 'Translation'
and
Ambiguity between
'VolunteerGames.Web.Translations.Translation.ResourceManager' and
'VolunteerGames.Web.Translations.Translation.ResourceManager'
I noticed that after changing the resource in designer (Translation.resx) a new file named Translation1.Designer.cs was created. It created another class called Translation. If I delete this new file I can compile, but the new strings I just created are not found when I try to use on my controller.
I can't understand what's going on. I've been working for months in this project and it was all good.
Because Visual Studio started to create the file Translation1.Designer.cs, and that new file conflicted with Translation.Designer.cs, and when I tried to delete it I got erros, then I deleted Translation.Designer.cs so everything is working now again.
For late-comer who encountered with the same problem
It looks like the project was created in ResX Schema older version (v1.3) but reopen(and save) in ResX schema v2.0, since the Schemea is auto created, the VS will do so because schema standard is different is not adaptable. We can have two files with completely same name in one directory, it attached a number with its original name
Related
I am using MapForce for the first time. I was able to successfully create an XML mapping. However, I am not sure how to run the generated code in Visual Studio, so that I can use it and see the output. I generated the code for the mapping in C# and did try to run the "Mapping" Project in VS.
Unfortunately, I am not able to due to few errors. There isn't a good documentation on the folders that are created in the project. If I can get a documentation link that I can refer to or if somebody can define why those folders are there and how can I use them/ how I should be running those projects.
Please correct me if I am wrong anywhere.
If you generated code to C:\MyFolder\, then you need to open in Visual Studio the solution C:\MyFolder\Mapping\Mapping.sln. Note that the "Mapping" is the default name, if you configured it to be something else from MapForce settings, then it may be different.
Solutions in other generated folders are supporting libraries, and you should never edit them (or at least do so at your own risk). The only file you can (but you don't normally need to) modify is called MappingConsole.cs. For example, you may want to change the paths of the mapping input/output files. In any case, after you build and run the solution, a Mapping.exe application is created in the Bin\Debug folder.
It would have been helpful if you indicated which errors you get. Perhaps the paths to the mapping input files cannot be resolved relative to the Mapping.exe application?
I created a new class library for windows store apps and within this library I created a Usercontrol in a folder named 'Controls'.
I use this class library in another project (especially this controls mentioned above) and everytime I try to run this project a weird error occurs:
"Payload file 'C:\PATH TO CLASSLIBRARY FOLDER\bin\Release\LIBRARYNAME\Controls\Usercontrol.xaml' could not be found"
So I opened my library's folder and looked up this path.
The path described in the error message does not exists but if you would replace
\bin\Release\LIBRARYNAME\Controls\Usercontrol.xaml with \bin\Release\Controls\Usercontrol.xaml then there is the wanted file.
Then I simply copied the \Controls\ folder containing Usercontrol.xaml and pasted it into the newly created folder \LIBRARYNAME\Controls\Usercontrol.xaml.
Now this error doesn't occur anymore but I don't want to do this copy-paste action everytime I modify Usercontrol.xaml?!
Does anybody know why this happens? Is there a way to avoid my inconvenient solution?
Thanks for help! :)
After doing some further researching with the exacty english error message (worked with german vs2012 by then) it seems that this is a bug in Visual Studio.
More info about this:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/51111470-8a86-44d4-acb8-e268afa7564e/
I've inherited a C# app which uses an .rdlc file. I get an error (not a warning) in my error list:
Cannot process 'reportTerminalStatus.rdlc' because it is not an EDMX
file.
but unlike normal code compilation errors it doesn't prevent the production of an executable file. I don't want to ignore it, but is it safe too?
I've googled for information about the specific problem, but I'm not coming up with anything. I'm using VS2010 Ultimate on Windows 2008 server, and I've just run Windows Update so I have to assume I'm fully up to date. Am I missing a component? I've tried it on a VS2008 machine with the same results.
This sometimes happens when build action is wrong for a file. In Visual Studio check properties for rdl. It might be set to EntityDeploy which is wrong.
according to
http://www.experts-exchange.com/Programming/Languages/.NET/Web_Services/Q_25956424.html
It has something to do with naming clash - specifically - you may have an entity (as in entity framework Entity) called
reportTerminalStatus
in the project, sharing the same path as the rdlc report.
Does changing the report name change anything ?
I have a Strings.resx file in my windows phone 7 mango project (using the latest RC tools for mango). This file contains localized strings for my application. However, it seems every time I make a change and save it, Visual studio adds a NEW Strings1.Designer.cs, Strings2.Designer.cs, etc... each time the file is saved. The original Strings.Designer.cs is no longer updated, so I keep getting Ambiguity errors. Any idea why this is happening?
I also found that in Visual Studio 2013 (possibly earlier as well) that the Strings#.designer.cs name is being saved in the .csproj file. So even once the file system issue is cleared up, VS continues to use Strings# for the filename.
Here are some additional details:
Why is the generated class for a resource file in a file with a different name?
It was just Windows Live Mesh interfering.
While working on an existing project I suddenly got the following error when trying to compile the solution:
error MSB3105: The item "[filename]" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
Now, as far as I'm aware, I did not make any change to the project that affects the resources. Also I have checked each and every file within the project, but there is no duplicate reference anywhere to this file.
Now I already found some forum entries regarding this error:
1) Open the .csproj file and remove the duplicate reference. [Tried this, but I cannot find any duplicates in it]
2) In a 'partial class' project, move everything to a single class. [ Could try this, but the project has been split up into partial classes since the start, and I do not want to change this just because of the error ]
So what else could cause this ?
Did you try showing all files in the Solution Explorer? You could have a duplicate .rsx file somewhere in there.
I found the answer in .NET forum posting by Roy Green, and Theresa was right after all, though I did not recognize it.
If you have your main form class split up into partial classes, the partial sections end up in the solution explorer as separate items. And if you double click on them they show up in the designer mode as a normal form. But if you (accidentally) drop a control on these forms, Visual Studio creates a new .resx file and a InitializeComponent routine for it. But since this form is actually just part of the Main Form class it leads to the 'duplicate resources' error. And there is no other solution but to remove the InitializeComponent routine and delete the .resx file by hand.
Be sure that under yourForm.cs no duplicate resources are defined (.resx). If you renamed your Form, remove the old resource because the new one during compile will be created with the new name.
I just made the same mistake. Delete the mainform.designer.vb, then I restored it again from the recycle bin, and found this error message when compiling.
I try to search on google and someone suggested to check on .vbproj. Did that and found a duplicate on some line.
I had this as well, in VB. There is the "real form" file frmMain, and then I had created new class files and modified them to be Partial Public Class frmMain. For example, I have an ImportFromExcel.vb Partial Class file (I didn't want to clutter up the frmMain.vb with the rather complicated Excel import code.)
Everything worked fine until I decided I wanted to use an OpenFileDialog in the Sub ImportFromExcel. I dragged the OFD from the toolbox over to the Designer view of the ImportFromExcel file. (I have no idea why this view exists, if you can't do anything with it!) But at any rate... dragging the OFD to the Partial Class Designer created an ImportFromExcel.resx file. The drag/drop operation also created an InitializeComponent sub in ImportFromExcel, which is redundant and shows an error -- easily corrected with a little editing.
Ultimately, I chose to not use the dragged resource, but localized the code in the ImportFromExcel.vb file.
All you really have to do is right-click the ImportFromExcel.resx file, and choose Delete. Everything else seems to "fix itself", and it builds fine now.
In my case, this problem happened because a file had the same name but not the same case in the GIT repository.
For example MyFile.cs and myFile.cs.
If you do a checkout on windows, one of the files is overwritten by the other (no message, no warning). So, it is compiling, and we don't notice anything. But if you try to compile on Linux (with .NET Core) both files are present, and there is this error at compile time.