**In CodeRunner Version 3.0.1 not detecting separate C# class files in same folder **
Example following will compile
using System;
public class Person {
}
class Student : Person {
}
But if both each class has it's own file and in the same folder then the compiler reports:
The type or namespace name `Person' could not be found. Are you missing an assembly reference?
Anyone any idea as how to sort this ?
When compiling multiple C# files within CodeRunner, You must list your assembly files prior to the compilation by defining them ALL in your "Run Settings" under the "Compile Flags":
ex.
/reference:System.Drawing ICar.cs M3.cs
Hope this helps 👍🏽
note:
ICar.cs and M3.cs are my custom classes
Related
I don't know how to call using UnityEngine.XR.ARFoundation in a C# script inside my own Package in Unity.
I have added ARFoundation in Dependencies of Package as shown in the image. But I'm getting "error CS0246: The type or namespace name '~' could not be found (are you missing a using directive or an assembly reference?)". How can I resolve this?
I solved the problem by creating Assembly Difinition Files in my own package and adding references to Assembly Difinition References.
I fixed this issue in "Edit" ... "Preferences" ... "External Tools", by checking "Regenerate Project Files"; this hopefully regenerates all the necessary ".csproj" files for IntelliSense tracking.
I am using IntelliJ.
To compiled my .scala file, at command prompt, and it created Item.Class file.
In IntelliJ, I created scala script file and tried to Instantiate the Item object
Item("Jacket", 10)
It says "Cannot resolve Item". I know this is a basic question. What is the best way to reference a compiled class in script files?
case class Item (name:String, quantity:Int) extends AnyVal{
}
I have a portable class library project that targets .NET 4.6 and Universal Windows Platform. This class library contains just one class with the following line of code in its constructor:
Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
Now I create a new .NET 4.6 console application project in the same solution and add a project reference to the portable class library. Calling the method that houses the above line of code results in the following exception at runtime:
Could not load file or assembly 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
What am I doing wrong here? There are no compile-time errors or warnings.
Things I have tried: add missing(?) NuGet package manually
It seems that System.IO.FileSystem is a library delivered via NuGet, as part of the Microsoft.NETCore mega-package. Okay, perhaps I need to explicitly add this package to any project that uses my portable class library. I attempt to do so.
Could not install package 'Microsoft.NETCore.Platforms 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
No luck with this approach.
Things I have tried: create a project.json file
While there is no clear info on the web, I read a few tidbits about a new project.json based NuGet harness or build system. Just to experiment, I created the following project.json file in my console application project:
{
"dependencies": {
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win-anycpu": { }
}
}
It works! The runtime error goes away! However, I soon found that this was either not the right solution or not a complete solution. I started writing some code to read configuration section values, which involved making use of the IConfigurationSectionHandler interface, and got the following compile-time error:
error CS0246: The type or namespace name 'IConfigurationSectionHandler' could not be found (are you missing a using directive or an assembly reference?)
This interface is part of the System assembly. I see a reference to this assembly, but it has a yellow exclamation mark icon, and a warning appears in the warnings window:
The referenced component 'System' could not be found.
This is where I ran out of ideas. Am I missing something totally obvious?
I have found the solution. My initial attempt was to install the Microsoft.NETCore package into the console application, resulting in the error shown in my original post.
However, if I install only the narrowly-scoped packages, e.g. System.IO.FileSystem, then I achieve success and the application works correctly. Apparently there is something special about the Microsoft.NETCore "master package" that prevents it from correctly installing into dependent projects.
While I'm trying to obfuscate simple DataLoader.class file in ProGuard I get this error:
Reading program directory [C:\Users\uzytkownik\Documents\NetBeansProjects\ProTest\build\classes\Files\DataLoader.class]
Warning: class [DataLoader.class] unexpectedly contains class [Files.DataLoader]
Warning: there were 1 classes in incorrectly named files.
You should make sure all file names correspond to their class names.
The directory hierarchies must correspond to the package hierarchies.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
If you don't mind the mentioned classes not being written out,
you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.
Here is the project:
http://www49.zippyshare.com/v/14668241/file.html
I will be grateful for your help.
Warning: class [META-INF/versions/9/module-info.class] unexpectedly contains class [module-info]
This is the issue I had and I tried few options mentioned below:
-keep class module-info
-keepattributes Module*
-dontwarn module-info
The option worked for me is 3.
Not sure why but it solves my problem and I am able to make the jar.
This issue comes when you upgrade something like I upgrade the spring-boot version and the project starts failing.
Please check the maven dependencies as well.
With the options -injars and -libraryjars, you should specify the proper base directory (or jar) of your classes, just like a classpath. In this case: classes, not classes\Files\DataLoader.class.
See the ProGuard manual > Troubleshooting > Warning: class file ... unexpectedly contains class ...
I created a custom assembly that I'm trying to run in my SSRS 2008 project. This is a simple static method in a class:
namespace Utilties
{
public class Expressions
{
public static string SayHello()
{
return "Hello Test!";
}
}
}
The project compiles into an assembly. Then I go to Report > Properties and add the assembly there and in the following location:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies
My understanding is that by default, the assembly already has execute permissions as I do not intend on adding Code support using CAS.
I inserted a textbox in my report with the expression:
=Utilities.Expressions.SayHello()
But when I build, I get an error:
[rsCompilerErrorInExpression] The Value expression for the textrun
‘Textbox16.Paragraphs[0].TextRuns[0]’ contains an error: [BC30451]
Name 'Utilities' is not declared.
Is there an additional step I'm missing?
Never mind the question. The problem was that I mispelled the namespace. Once I corrected the issue, the problem went away and everything worked the way it should.