In Visual Studio (Task Runner Explorer), I am trying to use gulp-sass-glob in my SCSS:
gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
sassGlob = require('gulp-sass-glob');
gulp.task('css', function () {
return gulp.src('./gulp/scss/**/*.scss')
.pipe(sassGlob())
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./css'));
});
site.scss
#import "modules/**/*.*";
But in Task Runner Explorer, I get the following error:
Error: File to import not found or unreadable: modules/**/*.*
Parent style sheet: C:/Users/.../scss/site.scss
on line 95 of gulp/scss/site.scss
>> #import "modules/**/*.*";
Does anybody know how to fix this error or if this is even achievable when using SCSS and gulp in Visual Studio?
gulp-sass-glob uses the glob package for path globbing. Its documentation has this to say about **:
** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches.
Notice the bolded part. It means ** only has special meaning when its the only thing between two slashes /.
Try the following in your site.scss:
#import "modules/**/*.*";
Related
I'm workng to get include path resolved by some VS plugin (asm-dude in fact). Include path in microsoft macro assembler looks like this:
includepath
Include file resolve part in asm-dude lies in: https://github.com/HJLebbink/asm-dude/blob/vxix2022-B/VS/CSHARP/asm-dude-vsix/Tools/LabelGraph.cs#L602
Anyway, at the beginning I think I just need to get the value of IncludePath property, and then other things can be done in a minute. But after reading some docs I realized I'm in a mess. It seems that VS prevents me to get names of all properties, but I can only get the value by the name.
Codes I write are like:
DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
Projects projects = dte.Solution.Projects;
if (projects.Count != 0)
{
VCProject project = (VCProject)projects.Item(1).Object;
VCConfiguration cfg = project.ActiveConfiguration;
if (cfg != null)
{
string includePathStr = cfg.GetEvaluatedPropertyValue("IncludePaths");
}
}
but in vein, it gets include path of msvc, not MASM
I cast Project to VCProject because it's a VC project. Although I can iterate properties of a non-VCProject's configuration, but it doesn't seem to work on VCProject, because it doesn't have a (at least not public) member named properties. All these docs tell me that I can only get its value by name, but the problem is I don't know its name. Or I'm completely wrong? I must admit that I'm new to VS plugins.
refs I used so far:
https://learn.microsoft.com/en-us/previous-versions/dn655034(v=vs.140)?redirectedfrom=MSDN
https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.vcprojectengine.vcconfiguration?view=visualstudiosdk-2022
Building solution in MS Build fails with error(given the sample error below). But when i try to build the same solution in VS, the build succeeds. Once built in VS, if i try in MSBuild, then it works.
I came across This question where i found that non-displyable character may be the issue. So i commented '=>' characters and try building it again, it succeeded.
Error Thrown:
App\AllActions.cs(27,43): error CS1002: ; expected[D:\DEM1\AAA\framework\Core\Core.csproj]
App\AllActions.cs(27,50): error CS1520: Method must have a return type [D:\DEM1\AAA\framework\Core\Core.csproj]
My Code is,
public Alert Alert => new Alert();
public Button Button => new Button();
public Checkbox Checkbox => new Checkbox();
public Dropdown Dropdown => new Dropdown();
public Frame Frame => new Frame();
public Label Lable => new Label();
public Link Link => new Link();`
MSBuild version = C:\Program Files (x86)\MSBuild\12.0\Bin
Visual Studio 2017
c# Version = 7.0
Any help on how to sort this out?
The problem is likely that you are using a version of msbuild (MSBuild 12.0) that doesn't support expression bodied properties added in C# 7.0.
The msbuild version you are using is seemingly from 2015 which AFAIK doesn't support C# 7.0
Try a later version of msbuild
I need to get the path where the solution file (.sln) is located. I try with this lines:
string startupPath = Path.Combine(Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName,"abc.txt");
// Read the file as one string.
string text = System.IO.File.ReadAllText(startupPath);
When I run it, I get an "Unauthorized Access Exception". When I put the path "manually": C:\Users\yabej\source\repos\tutoriales\Proyecto 0.1 it works!
However I need an "automatic" solution to be sure that the path will be correct when I run my project on different computers
The proper way to get the right solution path worked for me in Visual Studio 2019 with the EnvDTE100 NuGet Package.
Clarification: Only works with a single VS Instance Open (credits #junliantolovich)
Be sure use the correct ProgId for your Visual Studio:
using System;
using EnvDTE80;
using System.IO;
using System.Runtime.InteropServices;
namespace Test
{
public class Program
{
public static void Main()
{
var di = GetSolutionDirInfo();
Console.WriteLine(di.FullName);
}
public static DirectoryInfo GetSolutionDirInfo()
{
// Use here the ProgId of your Visual Studio
// VS 2010 -> "VisualStudio.DTE.10.0"
// VS 2012 -> "VisualStudio.DTE.11.0"
// VS 2013 -> "VisualStudio.DTE.12.0"
// VS 2015 -> "VisualStudio.DTE.14.0"
// VS 2017 -> "VisualStudio.DTE.15.0"
// VS 2019 -> "VisualStudio.DTE.16.0"
var progId = "VisualStudio.DTE.16.0";
var dte2 = (DTE2)Marshal.GetActiveObject(progId);
return Directory.GetParent(dte2.Solution.FullName);
}
}
}
If you add your file (abc.txt) to your solution, then in the properties for the file, you can set 'Copy to output directory' to 'Copy always'. Make sure the build action is set to 'None'. Then during the build process, it'll be copied to the same location as your executable and you can get the path using
var path = Path.Combine(Directory.GetCurrentDirectory(), "\\abc.txt");
I generate a coverage report using dotCover.exe from the command line, but it randomly fails with this error:
[JetBrains dotCover] Coverage session finished with errors: Out of allowed iteration to generate unique temp name
[location] = C:\Build Agent\work\f532b5455ffc19e9\Profiler\Kernel\Windows\Native\Solution\core\src\Util\temp_util.cpp(44)
[function] = class boost::filesystem::path __cdecl jetbrains::profiler::temp::`anonymous-namespace'::create_temp<class jetbrains::profiler::temp::create_temp_file::<lambda_91d5f1a5933e4e60038be7ca777762a9>,0x010>(const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class jetbrains::profiler::temp::create_temp_file::<lambda_91d5f1a5933e4e60038be7ca777762a9> &&)
[file name] = C:\Temp\ft.EC76593C.tmp
[WIN32 error] = 80, The file exists.
My command line looks like this:
dotCover.exe analyse /TargetExecutable=nunit3-console.exe /TargetArguments="unittest1.dll unittest2.dll ... unittest10.dll" /ReportType="html" /Output=CodeCoverage.html /Filters="+:*;-:*.*Tests;-:*.*.Tests;-:*.Tests;-:*.Tests*" /TempDir=C:\Temp\
It seems the more DLLs I try to cover the more likely it is to fail with this error. From the error message it seems dotCover is written in C++ and it's using boost::filesystem::path to create a temp file but there is some race condition and it tries to create a new temp file where it already exists. My dotCover version is JetBrains dotCover Console Runner 2017.1.2. Build 108.0.20170428.80910.
Does anyone have any idea what's how to fix that error?
Edit: There is another error with which it fails - Access is denied:
[function] = class boost::filesystem::path __cdecl jetbrains::profiler::temp::`anonymous-namespace'::create_temp<class jetbrains::profiler::temp::create_temp_file::<lambda_91d5f1a5933e4e60038be7ca777762a9>,0x010>(const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class jetbrains::profiler::temp::create_temp_file::<lambda_91d5f1a5933e4e60038be7ca777762a9> &&)
[file name] = C:\Temp2\ft.0A96C261.tmp
[WIN32 error] = 5, Access is denied.
Again, this happens randomly - usually it will fail 3 times and then run successfully on the 4th.
was running into this issue at times, using the early access version(JetBrains.dotCover.CommandLineTools.2017.2.20170630.95316-eap06) made it disappear the issue till now.
Looks like a bug in the dotcover tool opened here .You can
download the latest version of dotcover commandline tools from
here
Edit:
Get the latest version of dotcover from here as it has the issue resolved
I found this code to invoke the Matlab compiler, it works fine when the function is called from Matlab command prompt, I build this function to .Net Assembly but whenever I try to use it in my C# app in order to build some .m file I get an exception, where do you think my problem is?
Matlab Code:
function compileCode(mfile,dllName , dnetdir)
%% Create directories if needed
if (exist(dnetdir, 'dir') ~= 7)
mkdir(dnetdir);
end
%% Build .NET Assembly
eval(['mcc -N -d ''' dnetdir ''' -W ''dotnet:' dllName ',' ...
'' dllName ',0.0,private'' -T link:lib ''' mfile '''']);
end
C# code:
var cmm = new compiler.MatlabCompiler();
MWCharArray x = new MWCharArray(#"C:\Users\ePezhman\Documents\MATLAB\Graph2D.m");
MWCharArray y = new MWCharArray("Graph");
MWCharArray z = new MWCharArray(#"C:\Matlab\dotnet");
cmm.compileCode(x,y,z);
Exception:
... MWMCR::EvaluateFunction error ... Undefined function 'mcc' for
input arguments of type 'char'. Error in => compileCode.m at line 9.
... Matlab M-code Stack Trace ...
at file C:\Users\ePezhman\AppData\Local\Temp\ePezhman\mcrCache8.0\compil0\compiler\compileCode.m,
name compileCode, line 9.
Interesting, I assume you are trying to compile a function that can dynamically compile other functions..
Unfortunately, I dont think the mcc function can be compiled/deployed itself
To be exact, the problem you are seeing is because MATLAB needs to know all functions called at compile-time, and by using eval, it wont figure it out on its own (since it wont parse inside the string). You can fix this particular issue by writing special comments for the compiler..
function myEval()
%#function foo
eval('...');
end
(Another alternative is using function handles).
Still even if you do that, it will fail at runtime inside the mcc function saying that: "License checkout failed, [...] Cannot find a valid license for Compiler".
The reason is as mentioned in the comments, mcc is a development tool and cannot be deployed to standalone programs which only depends on the free MCR runtime.
Think about it, if it was possible, it would defeat the whole purpose of buying licenses for the product, as you could create a standalone program that can compiler other codes without having the Compiler toolbox :)