Coder Social home page Coder Social logo

Comments (9)

erik-kallen avatar erik-kallen commented on August 30, 2024

Interesting.

I will look into it. For the time being, to get your intellisense back, I suggest downloading an evaluation version of ReSharper 7 (which does get it right, that's why I haven't noticed the problem myself).

from saltarellecompiler.

volkanceylan avatar volkanceylan commented on August 30, 2024

When i tried to install Santarelle runtimes into GAC, it gave an error as DLL's are targeted for a newer framework. I checked in ILSPY and it also shows your mscorlib runtime version as 4.0. When i set project to 4.0 runtime, this time, it complains about System.dll reference missing etc. Don't know if it is related, but might help.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on August 30, 2024

You can't install saltarelle runtimes into the GAC, since they use a non-standard mscorlib.

And the Saltarelle mscorlib version is 1.1.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on August 30, 2024

Visual Studio seems to have a "feature" that makes intellisense for mscorlib unusable unless the standard Microsoft.CSharp.targets is included in the build.

Actually, it seems that the rule is that the Csc task must be invoked with the correct arguments at the correct point in the build (where the exact definition of correct is unknown to me, but just inserting a dummy call does not help).

For the time being, I recommend using ReSharper, which doesn't have this "feature", and I guess I'll have to contact the VS team at Microsoft to get help with the issue.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on August 30, 2024

MSDN forum link: http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/cdcb3eac-8044-446e-b585-834e8d8214f8

from saltarellecompiler.

volkanceylan avatar volkanceylan commented on August 30, 2024

By some trial and error, i changed your .targets file as below, and it works now:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

    <UsingTask AssemblyFile="SCTask.dll" TaskName="SCTask"/>

    <PropertyGroup>
        <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
        <DefaultLanguageSourceExtension>.cs</DefaultLanguageSourceExtension>
        <Language>C#</Language>
            <EmitDebugInformation>false</EmitDebugInformation>
    </PropertyGroup>

    <PropertyGroup Condition="'$(DebugType)'=='pdbonly' Or '$(DebugType)'=='full'">
            <EmitDebugInformation>true</EmitDebugInformation>
    </PropertyGroup>

    <ItemGroup>
        <IntermediateScript Include="$(IntermediateOutputPath)$(TargetName).js" Condition="'@(IntermediateScript)'==''"/>
    </ItemGroup>

  <Target Name="AfterCompile" DependsOnTargets="$(CoreCompile)" 
          Inputs="$(MSBuildAllProjects);
                $(AssemblyOriginatorKeyFile);
                @(Compile);
                @(ReferencePath);
                @(CustomAdditionalCompileInputs)"
        Outputs="@(DocFileItem);
                 @(IntermediateScript);
                 @(IntermediateAssembly);
                 @(CustomAdditionalCompileOutputs)"
        Returns="">
      <SCTask  AdditionalLibPaths="$(AdditionalLibPaths)"
               DefineConstants="$(DefineConstants)"
               DisabledWarnings="$(NoWarn)"
               DocumentationFile="@(DocFileItem)"
               EmitDebugInformation="$(EmitDebugInformation)"
               KeyContainer="$(KeyContainerName)"
               KeyFile="$(KeyOriginatorFile)"
               OutputAssembly="@(IntermediateAssembly)"
               OutputScript="@(IntermediateScript)"
               References="@(ReferencePath);@(ReferenceDependencyPaths)"
               Sources="@(Compile)"
               TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
               WarningLevel="$(WarningLevel)"
               WarningsAsErrors="$(WarningsAsErrors)"
               WarningsNotAsErrors="$(WarningsNotAsErrors)"
     />
  </Target>

  <Target Name="CopyFilesToOutputDirectory">
    <Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(OutDir)" />
    <Copy SourceFiles="@(IntermediateScript)" DestinationFolder="$(OutDir)" />
  </Target>  
</Project>

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on August 30, 2024

Unfortunately this compiles the code twice, which is something I want to avoid if at all possible.

The VS behaviour seems to be something like:
Intellisense starts working for a file the first time that file is compiled with the Csc task producing the @(IntermediateAssembly) output.
Once Intellisense has started working for a file, it will keep working forever.
Just because one file in the project works, it doesn't mean that other files in the same project will. Each file has to be a source to the Csc task before that file will start working.
Restarting VS does not cause Intellisense to stop working for files it is already working for.

I would LOVE to see the VS code behind this behavior.

from saltarellecompiler.

volkanceylan avatar volkanceylan commented on August 30, 2024

I don't know anything about how these .targets files or Visual Studio build process works.

I took a look at how ScriptSharp and VannatechBlade .targets file is written, and they both use AfterCompile target.

Not sure why your SCTask compiles code again? AFAIK, ScriptSharp's ScriptCompilerTask doesn't compile code. Just reuses already compiled IntermediateAssembly (maybe not even that), source, and project files.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on August 30, 2024

I do that for two reasons:

  1. I want the task to be self-contained, so the build doesn't rely on third-party task to also be called (passing invalid code to the script compilation will give you internal errors), and
  2. I had the idea (now abandoned or at least put on hold) that the compiler should annotate the output assembly with eg. [ScriptName] attributes to ensure that overload resolution works across assemblies (don't worry, it still does work, I decided to use a deterministic naming algorithm instead).

Obviously neither of these reasons are more important than working VS IntelliSense, so I should change this (I will add an extra task parameter to the SCTask that tells it not to build the output assembly). But it was a VS feature that was hard to foresee.

from saltarellecompiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.