I am following the answer below to make globalization happen.
Globalization in ASP.Net MVC 3
However, I have failed.
I am getting back a compilation fail error for the following line:
using ViewResources;
I have created Resources folder, created 2 resource file per locale(ViewResources.resx, ViewResources.en.resx), added
<add namespace="ViewResources" />
to web.config in Views folder and it fails like a boss.
Compiler Error Message: CS0246: The type or namespace name 'ViewResources' could not be found (are you missing a using directive or an assembly reference?)
You need to specify that the file type as 'embedded resource', to do this select the file in solution explorer, right click-> select properties, change build action to 'embedded resource'
Related
I renamed my project, and updated it to .Net 5. Now, I obviously havent catched all the occurances since I get this error:
\source\repos\BlazorBattles\BlazorBattles\Server\obj\Debug\net5.0\Razor\Pages\Error.cshtml.g.cs(78,71): error CS0246: The type or namespace name 'blazor_battles' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\hagenek\source\repos\BlazorBattles\BlazorBattles\Server\BlazorBattles.Server.csproj]
However, it is hard to locate it, because the error shows a file that is being generated by the project ,not a file that is in the core project.
Any tips?
For some reason visual studio could not locate the string "blazor_battles" in the Error.cshtml file inside of Server/Pages directory.
Using hyphens in your project names creates problems. Don't do it.
First and foremost, I've never worked with C#, or any compiled language for that matter. So I'm hoping I'm just doing something wrong here.
We have an old in house app, written in c# that has some smtp settings hard coded that need to be changed. I have the source files, and even the .sln visual studio project file. So I open the project in vs, make the required changes, and go to build- however I'm running into errors (Build -> Build 'Autodocs' (the name of our app)):
Build started...
1>------ Rebuild All started: Project: AutoDocs, Configuration: Debug Any CPU ------
1>C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs(10,38,10,54): error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)
1>C:\shared\New folder\AutoDocs\AutoDocs\modules\DWStorer.cs(7,7,7,15): error CS0246: The type or namespace name 'DocuWare' could not be found (are you missing a using directive or an assembly reference?)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
So does anybody have any suggestions for a c# newbie like me? Anything I should have to do when copying a project dir from the server to my pc to build it?
Thank you in advance.
Do you know what kind of program it is? Windows? ASP.NET? MVC?
The errors are shown, but let's go through them:
1>C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs(10,38,10,54):
error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the
namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)
First, look in this document:
C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs
Somewhere in that file, when viewing in Visual Studio, you will see the word CustomMarshalers, and it needs to be referenced.
So, in your project, you will need to right-click the References section and add that missing reference (if it isn't there already):
Also, at the top of your Documents.cs file, you need to have a line like this:
using System.Runtime.InteropServices;
See Microsoft's documentation here: System.Runtime.InteropServices.CustomMarshalers
Here is your second error:
>C:\shared\New folder\AutoDocs\AutoDocs\modules\DWStorer.cs(7,7,7,15):
error CS0246: The type or namespace name 'DocuWare' could not be found
(are you missing a using directive or an assembly reference?)
Similar to the first error, this one is having an error in the DWStorer.cs file because it cannot resolve the keyword DocuWare.
DocuWare is a third party tool that must be added to your references and added to the top of your DWStorer.cs file.
DocuWare
You may have to go to the link above to download their tool if you do not have it in your project somewhere.
I am working on an ASP.NET website and as part of the website I created a file called Global.cs which is used to hold all my helper classes. However, unfortunately, I am constantly getting errors saying there has been a problem while compiling this file. All the classes inside the file are included in single namespace - "Global".
When using it 'inline' eg. Global.SomeStaticClass.Method() :
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: CS0103: The name 'Global' does not exist in the current context
When using "using Global;" directive:
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: CS0246: The type or namespace name 'Global' could not be found (are you missing a using directive or an assembly reference?)
As suggested in many posts, I tried including the class in App_Code folder of my project and the namespace, "Global", is detected by the Visual Studio (no errors when adding "using Global;" directive, or when using it inline "Global.Class.Method()". However, it still fails whenever I try to access the page in the browser.
I could not find a simple solution to my problem and decided that the easiest and the most time efficient solution will be to convert my Website project to a Web Application project. You can read how to convert your Website to a Web Application at: https://blogs.msdn.microsoft.com/webdev/2009/10/29/converting-a-web-site-project-to-a-web-application-project/
With the project converted to a Web App I was able to attach my class files after compiling them to a DLL library, as it did not accept any uncompiled files inside App_Code folder by throwing an exception.
The directory '/website/App_Code/' is not allowed because the application is precompiled.
If you encounter the same issue, you can learn how to compile C# files using Developer Command Prompt here: https://msdn.microsoft.com/en-us/library/78f4aasd.aspx
When I test my web site (asp.net c# .net4) on the localhost, everything works fine.
However, when I publish it to my webserver, I get the error:
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: CS0246: The type or namespace name 'MyWhateverNamedHere' could not be found (are you missing a using directive or an assembly reference?)
My code file (MyWhateverNamedHere.cs) lives in my App_Code folder, which IS moved to the webserver.
I have read where people move codefiles out of the App_Code folder. Didn't work for me. I tried giving them namespaces, and static references and just about everything I can think of. Then I found a solution that said Build Phases > Compile. But that's not an option for "web sites".
Any help?
I just started using WiX, with zero knowledge of C#/.NET
Now I'm trying to create a simple WiX extension by referring this page: WiX3 - Simple Example of Extension.
Here is steps described in that page:
In Visual Studio, create a new C# library (.dll) project named SampleWixExtension.
Add a reference to wix.dll to your project.
Add a using statement that refers to the Microsoft.Tools.WindowsInstallerXml namespace.
using Microsoft.Tools.WindowsInstallerXml;
Make your SampleWixExtension class inherit from WixExtension.
public class SampleWixExtension : WixExtension {}
Add the AssemblyDefaultWixExtensionAttribute to your AssemblyInfo.cs.
[assembly: AssemblyDefaultWixExtension(typeof(SampleWixExtension.SampleWixExtension))]
Build the project.
However, when I finished these steps and built this project, I met following errors:
------ Build started: Project: SampleWixExtension, Configuration: Debug Any CPU ------
D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtension' could not be found (are you missing a using directive or an assembly reference?)
D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtensionAttribute' could not be found (are you missing a using directive or an assembly reference?)
Compile complete -- 2 errors, 0 warnings
Anyone know why and how to fix it?
Btw, in the Solution Explorer I can see wix is already in References, its properties has Path of C:\Program Files (x86)\Windows Installer XML v3.5\bin\wix.dll
By adding
using Microsoft.Tools.WindowsInstallerXml;
into AssemblyInfo.cs, the project is now successfuly built.