Errors after closing and opening project in visual studio - visual-studio-2019

Almost always when I close a project in Visual Studio, it almost alwyas have these types of errors (written down below) when I open the project again, even if it didn`t have any errors when I closed the program. Anyone who knows why this happens and how I could fix it?
Error CS0101 The namespace 'uppdrag_2.cs' already contains a definition for 'Program'
Error CS0101 The namespace 'uppdrag_2.cs' already contains a definition for 'SecondClass'
Error CS0111 Type 'Program' already defines a member called 'Main' with the same parameter types
Error CS0111 Type 'Program' already defines a member called 'Newcustomer' with the same parameter types
Error CS0121 The call is ambiguous between the following methods or properties: 'Program.Newcustomer()' and 'Program.Newcustomer()'
Thank you in advance!
//Johanna

Related

Error 43 The type or namespace name 'ViewAsPdf' does not exist in the namespace 'Rotativa' (are you missing an assembly reference?)

I am getting this error:
Error 40 The type or namespace name 'ViewAsPdf' does not exist in the
namespace 'Rotativa' (are you missing an assembly
reference?) D:\SandeepPatil\PPD_Projects\Code\Karma_Retail\Karma.Store\Areas\Admin\Controllers\OrderController.cs 1757 45 Karma.Retail.Web
You may be missing the reference to the Rotativa dll which was reported as an error in version 1.7.3, found here. There's now a prerelease version 1.7.4-rc which presumably fixes this issue.
This error is caused by trying to instantiate a Rotativa.ViewAsPdf object which, I am pretty sure, is not an object but a static method of the class Rotativa.
From the surrounding code I can read on your screenshot, I can assume the method ViewAsPdf returns a byte array, in which case the simplest solution would be to remove the new in front of it, which serves absolutely nothing in that case.
Please note that this answer is only based on assumptions due to the low amount of informations provided by your screenshot. You might want to publish your code in the question for us to better understand the context.

Unable to retrieve metadata for 'MVCMusicStore.Models.Album

In section 5 of the ASP>NET MVC Music Store example, "Creating the StoreManagerController," when I click "Add" I get the error,
There was an error running the selected code generator:
'Unable to retrieve metadata for 'MVCMusicStore.Models.Album.'
The popular solution is to comment out the connection string in Web.config. This did not work for me. After trying many things I decided to add the code manually, by taking it from the completed code that's included with the example. When I do that I receive the error,
Compiler Error Message: CS0234: The type or namespace name 'Album' does not exist in the namespace 'MvcMusicStore.Models' (are you missing an assembly reference?)
and on line 31 I see the error,
public class _Page_Views_StoreManager_Index_cshtml : System.Web.Mvc.WebViewPage<IEnumerable<MvcMusicStore.Models.Album>>
Album is defined in the models folder. I have used webform development many times and am trying to add MVC to my repertoire. It seems to me "Album' is not registered, but I don't even know if that's appropriate lingo for MVC. What's the problem? I'm running this example in Visual Studio 2017.
The problem with line 31 is my project is named "MVCMusicStore". In the completed code I imported it's "MvcMusicStore". So it's looking at the wrong thing for the 'Album'namespace. Still don't know what causes the first error.
After correcting the namespace in the sample file, that error goes away and the new error is on the line;
#foreach (var item in Model{
the error is "System.NullReferenceException 'Object reference not set to an instance of an object.'

Error: An error occurred while skipping data rows

I am getting these errors in flat file connection manager.
Error: [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source returned error code 0xC0202091. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
I am reletively new to ssis and I am finding it quite hard to figure out the issue. Please let me know your views.
On your flat file connection properties - Look for the property "AlwaysCheckForRowDelimeters" - SET it to FALSE.
Hope that helps.
"An error occurred while skipping data rows" - I had this error in a package and found the problem was reading files inside a for loop. More files matched the criteria than intended, so a file with an invalid schema was also matched.
More generally I think this is related to either the file not matching the connection definition, I have also seen people online saying it is related to the flat file using a text qualifier (i.e. " in a csv) but having no closing quote.
I had this error today, and my package was looking for more files than existed based on the conditions of the for each loop. The text qualifier wasn't the issue causing this particular error.
near the Start button press drop-down menu arrow
choose package_name Debug Properties
than under Configuration Properties open Debugging
than under Debug Options choose Run64BitRuntime and turn it to False

Delphi 7 throws an error: RLINK32 Too many resources to handle

Delphi 7 has decided that it no longer want to cooperate. I was working on a relatively small project and was all but finished, but as I chose an icon for the exe-file the program threw this error: RLINK32 Too many resources to handle.
Now it throws that error even on a completely empty form whenever I try to compile it.
Just for the record:
Today I ran into this error (also using Delphi 7). I was editing the DFM directly/manually (for my project is a pure WinApi application).
I got the error when assigning an empty string to a property (inside the DFM file).
Caption = ''
Obviously, the RLINK32 error was gone as soon as I removed the infamous empty string (which the compiler doesn't like), or after changing the value to a non-empty string.

Add a reference to ASP.NET MVC ASPX page

I have some HTML Helpers that I imported from an external project. How do I reference them within the ASPX file?
Currently I get an error similar to the following:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<LC.TLAdminMVC.DAL.BusinessObjects.CompanySingleViewModel>' does not contain a definition for 'Configurator' and no extension method 'Configurator' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<LC.TLAdminMVC.DAL.BusinessObjects.CompanySingleViewModel>' could be found (are you missing a using directive or an assembly reference?)
To better understand your situation can you answer one question.
Have you placed the helper methods inside the aspx files or are they external?
If they are external:
Make a directory in your solution named: app_code
Create a new file, whatever name (we'll call it 'Content')
When you want to use the helper method just call Content.methodName(params)
If they are internal:
Try checking if they are not nested inside a block.
Hope this helps,

Resources