Announcement

Collapse
No announcement yet.

Simple csproj works in VS2017 but doesn't work with bridge cli

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple csproj works in VS2017 but doesn't work with bridge cli

    Our goal is to build in VS2017 as developers but have a Linux CI machine build with the bridge CLI.
    But to even simplify things further we have a case where even on Windows, the project doesn't build (bridge build)

    Since I don't see a way to attach the zip--hopefully these steps reproduce the error I'm seeing:

    1. mkdir test && cd test && bridge new
    2. Create a csproj file with the following contents:
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net461</TargetFramework>
      </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Bridge" Version="17.3.0" />
        <PackageReference Include="Bridge.Core" Version="17.3.0" />
        <PackageReference Include="Retyped.dom" Version="2.8.6733" />
        <PackageReference Include="Retyped.es5" Version="2.8.6733" />
    </ItemGroup>
    </Project>
    3. Build project in VS 2017 -- Success
    4. Run bridge build -- Fails with:
    Bridge.NET Compiler error: exception level: 0 - Invalid URI: The format of the URI could not be determined.
    Stack trace:
       at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
       at Bridge.Translator.Translator.BuildAssembly()
       at Bridge.Translator.Translator.Translate()
       at CallSite.Target(Closure , CallSite , Object )
       at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)
       at Bridge.CLI.Program.Main(String[] args)
    I figured I'd start here and once we figure this out I can post details about the Linux issue (which may be related but has a different looking error).

    #2
    Ran into a similar problem with the new csproj format and Bridge CLI (https://forums.bridge.net/forum/comm...ing-dotnet-cli).

    VS 2017 can build it and msbuild from the command line can build it, but bridge build fails. Not sure how this will translate to Linux with Mono, but is probably related.

    Comment


      #3
      I did see your post!

      I get errors when using MSBuild. Ideally we want a CI build to use exactly the same commands to prevent "it works on my machine" syndrome.

      Running msbuild /t:build {proj}
      Project "C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj" on node 1 (build target(s)).
      C:\Program Files\dotnet\sdk\2.1.201\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(327,5):
      error : Assets file 'C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\obj\project.assets.json' not found. Run a Nu
      Get package restore to generate this file. [C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj]
        Build continuing because "ContinueOnError" on the task "ReportAssetsLogMessages" is set to "ErrorAndContinue".
      C:\Program Files\dotnet\sdk\2.1.201\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5):
      error : Assets file 'C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\obj\project.assets.json' not found. Run a Nu
      Get package restore to generate this file. [C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj]
      Done Building Project "C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj" (build target(s)) -- FAILED.
      
      
      Build FAILED.
      
      "C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj" (build target) (1) ->
      (ReportAssetsLogMessages target) ->
        C:\Program Files\dotnet\sdk\2.1.201\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(327,5)
      : error : Assets file 'C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\obj\project.assets.json' not found. Run a
      NuGet package restore to generate this file. [C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj]
      
      
      "C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj" (build target) (1) ->
      (RunResolvePackageDependencies target) ->
        C:\Program Files\dotnet\sdk\2.1.201\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(167,5)
      : error : Assets file 'C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\obj\project.assets.json' not found. Run a
      NuGet package restore to generate this file. [C:\Users\~\Desktop\Example-VS-Works-CLI-Broken\test.csproj]
      
          0 Warning(s)
          2 Error(s)
      
      Time Elapsed 00:00:00.34
      In the error it hints at attempting to run nuget restore, this doesn't help.
      Last edited by selinc; 2018-10-02 @ 10:17 PM.

      Comment


        #4
        In your post it looks like you were using dotnet build instead of bridge build
        -- Edit -- Ah I see you tried that later on.

        Comment


          #5
          I recognize that error about the missing project.assets.json file. Before running msbuild, you'll need to restore the nuget packages. You should be able to do that with dotnet restore or msbuild /t:restore (or even using nuget.exe command line tool or similar, not sure which would be the most accessible on Linux).

          Ultimately, for my own project, I have decided to require the following installs for development:
          .NET Core SDK: https://www.microsoft.com/net/downlo...-x64-installer (gives global access to dotnet cli tool)
          VS Build Tools: https://visualstudio.microsoft.com/t...ldTools&rel=15 (installs msbuild and friends)
          hMSBuild script: https://github.com/3F/hMSBuild (helper batch file that automatically finds and runs installed msbuild on Windows)

          For the last two, I imagine you would have some Mono equivalent version of msbuild for Linux.

          Edit: Oh I see you tried nuget restore already. Hmmm, might be worth trying dotnet restore or msbuild /t:restore though.

          Comment


            #6
            I'll give those a try. I'm using .Net Core on linux.

            Comment


              #7
              I'd still like an answer on the new file format support. But in the meantime I've narrowed scope down to the CLI not working on Linux for even the simplest old csproj format (https://forums.bridge.net/forum/comm...g-docker-image)

              Comment


                #8
                We can consistently run Bridge CLI in the simplest case, which is creating a project from CLI's template. You could try that yourself and see what happens. From that point you could probably compare what's different between the projects and identify what exactly is making it break.

                On a new/blank directory:
                bridge new
                bridge build


                Then you should get a file under dist/<directory_name>.js file with some Bridge-built code.

                Hope this helps!

                Comment


                  #9
                  "bridge new" doesn't even create a csproj file.

                  This is what I did. I ran the new library bit and am still having issues with the CLI. See the other post linked in my post above.

                  Comment

                  Working...
                  X