How do I configure the Razor *.cshtml editor's C# compiler settings outside of an ASP.NET project? - razor

(This is not a duplicate of Print and/or modify the c# version that the razor compiler service uses to compile cshtml because I'm using RazorGenerator, not ASP.NET, the translation from .cshtml to .cs happens every time I press the Save button in Visual Studio, so adding assembly references or NuGet packages to my project won't help)
I have a C# Class Library project using RazorGenerator (a Visual Studio extension that transpiles .cshtml to .cs sources). RazorGenerator itself works fine and my .cshtml files are converted to cs correctly without any problems considering I'm using C# 7.3 language features and types defined in custom assemblies.
The problem is Visual Studio's own .cshtml designer (independent of RazorGenerator) seems to default to the C# 4.0 compiler version and doesn't even load System.Core.dll - so when viewing .cshtml files in the Visual Studio editor I get peppered with error messages that shouldn't be there:
"Feature 'out variable declaration' is not available in C# 4. Please use language version 7.0 or greater."
and broken namespace imports because it isn't loading assemblies:
I saw these SO posts:
Where to configure Razor page language version to C# 6?
C# 6.0 Features Not Working with Visual Studio 2015
...which suggest adding the NuGet Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to the project and restarting Visual Studio, however that did not solve the issue.

Related

C# .Net Framework Class Library proj - Newtonsoft.Json gives "The system cannot find the file specified..." error

The project is a Class Library which I want to use it from a Visual Foxpro application. Visual Foxpro is 32bit.
.Net project:
Target framework .Net Framework 4.7.2
Target Platform x86.
Using Newtonsoft.Json and RestSharp
I registered the DLL using RegAsm and I am able to create an object of that from Visual Foxpro. Things are fine, if I simply do some string manipulation and I am getting return value from DLL into Visual Foxpro program.
Now, when I enable RestSharp, it breaks and throws below error:
*OLE IDispatch exception code 0 from System.Memory: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified...
*
I am not sure how this version conflict came up when I installed packages afresh and have not copied any file manually.
Any clue?
Thanks in advance
Rajesh
My Visual Foxpro test folder is different and I have copied all files from my .Net Debug folder into that folder.

Razor "cshtml.g.cs" files not being generated

I created a brand new .net core 2.2 web application project, but I get this error when building:
I already reinstalled VS 2019 (16.3.10) and the .Net Core SDKs. Same project builds fine on other machines. Seems like razor has some global configuration for generating these cshtml.g.cs files, but reinstalling VS was not enough to fix it, these files are not being generated inside obj\Debug\netcoreapp2.2\Razor\Views folder.
What is the possible reason for this?

How do I import Primefaces 6.0 source as maven project in Eclipse?

I followed Building From Source https://github.com/primefaces/primefaces/wiki/Building-From-Source instructions. Building the SNAPSHOT version project from command works well.
However, importing it into eclipse using the Existing Maven Projects wizard gives me a lot of errors in the Problems view. I fixed the lifecycle mappings by setting all to ignore.
I realized the generated source code in the target/generated-sources/maven-jsf-plugin directory but it was not picked up by the m2e plugins as a source folder automatically. So I included it into the eclipse build path manually. But then again, many compile errors show up in the generated code.
Does anybody use eclipse as IDE for primefaces development? How do you setup the eclipse project to develop primefaces?
The eclipse project uses Java Compiler compliance level 1.5 derived from the pom.xml maven-compiler-plugin settings. Setting the Java Compiler compliance level to 1.6 solved the issue for me.

Microsoft Visual C++ Runtime Package framework is missing the framework dependency declaration in the manifest

I receive the following error on the Windows App Certification Kit for Windows 8.1.
The app manifest test detected the following errors:XXX takes a
dependency on Microsoft Visual C++ Runtime Package
(Microsoft.VCLibs.110.00) framework but is missing the framework
dependency declaration in the manifest.
My solution builds with zero errors. However, I receive an error after I create an app package and run the Windows Application Certification Kit.
I have added and removed references to the C++ runtime extension.
In addition, I do not see any fields in the app manifest editor to modify that would resolve this dependency error.
It sounds like you are including a library that was built with Visual Studio 2012. You will need to rebuild that library in Visual Studio 2013. If you just have the binary you will need to get an updated version from the author.
..
Or
Rename "Microsoft.VCLibs.110" to Name="Microsoft.VCLibs.110.00",
Or
Add a reference in your project to Microsoft Visual C++ Runtime Package
Add reference and find this Package. Adding this should resolve your problem

How do you define a default html in silverlight?

How do you define a default html in silverlight?
In the Microsoft Development Environment, Microsoft Visual Studio, when I build a silverlight project, the code auto-generates an HTML file in the Release directory (and in the Debug directory)
Yet, I have seen some projects that have a Default.html file among the project files. And when I run the program in debug mode, the default.html comes up.
How is this done? Where is the settings which tell Visual Studio which html to use when running or debugging. In another project, when I create a project from scratch, the program runs a generated html in the debug or release directory.
How do I include my own html in a silverlight project?
In the project settings, I found you can unselect the option to have the compiler auto-generate an html or use one that you define.