Reading DWG/DXF

Was this article helpful?
0 out of 0 found this helpful

Comments

3 comments
Date Votes
  • Currently I'm trying to get this to work as advertised, but I keep having issues.

    I'm building a WPF app that references a core app.dll library project. Both project use .Net 7.0.13. To this library I added the references using all thinkable ways:

    • Adding a direct reference to a copy of the 3 .dll files from the ...\bin\.net60 in my project folder
    • Adding references to the nuget packages.using package manager (console)
    • Adding references using the new (awesome) vs2022 extensions menu

    However whatever option I choose, as soon as I build the app it only copies .dll files into the output directory. All the .tx files are left out.

    private void WriteDxf(string fileName)
    {
        var wap = new WriteAutodeskParams(_dxfDocument);
        var dxfFile = new WriteAutodesk(wap, Path.Combine(_settings.DxfOutputFolder, fileName));
        dxfFile.DoWork();
    }

    This piece of code then crashes the app on the dcfFile.DoWork(); line, giving me the exception below:

    DllNotFoundException: Unable to load DLL 'TD_SwigCore_23.11_14.dll' or one of its dependencies

    Workaround is now copying all .tx files in my output directory manually. If I do that, it works.

    Obviously I'd expect it to be able to put all necessary dependencies in the output folder by itself, so please tell me, is this a bug or am I missing something here?

    1
  • Very strange! It suddenly all started working! 

    I now only have two nuget package references to the local nuget packages.

    Maybe A clean build or a restart of VS2022 did the trick, I have no idea.

    Now I only have to find out how I get this to build in my CI/CD pipeline :(

     

    0
  • A quick tip if you want to use the direct inclusion route, take these steps:

    1. Copy all the files from the C:\Program Files\devDept Software\Eyeshot 2023\Bin\net60 and (one of) the two x64 or x86 subfolders to a folder inside your (shared) project in a sub folder called Libs for instance
    2. Create a reference to one or more assemblies by right clicking Dependencies in your projects solution explorer -> Browse -> Browse... and navigate to the Libs folder you created in step 1. You can select one or more of the following:
      - .\Libs\devDept.Eyeshot.Control.Wpf.v2023.dll (WPF)
      - .\Libs\devDept.Eyeshot.Control.Wpf.v2023.dll (Winforms)
      - .\Libs\devDept.Eyeshot.v2023.dll (Console/Non visual use)
      - .\Libs\(x64|x86)\devDept.Eyeshot.(x64|x86).v2023.dll (DWG/DXF)
    3. Now to make sure everything gets copied to the root of your build output do the following
      Open your .csproj file and add the following ItemGroup somewhere near the end
        <ItemGroup>
        <None Update="Libs/x64/*">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
          <TargetPath>%(Filename)%(Extension)</TargetPath>
        </None>
      </ItemGroup>
      This will make sure all the files are inside are copied into the correct location, including the .tx files
    4. Now add references for all other projects in your solution that also need the eyeshot libraries. Follow the procedure explained in Step 2 for each of them.

    Note 1: Although this method is a little bit more involved, it does also work when you build in a CI/CD pipeline, because all the necessary binaries are included as part of the repository (if you don't accidentally excluded them in your .gitignore file :). 

    Note 2: If you receive `Duplicate output...` errors when you publish your application (>= .net6) you can add this tag to the `PropertyGroup` section of your executables .csproj file
    <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>

    See this link for more background on this topic: https://stackoverflow.com/a/69919694/1816032 

     

    0

Please sign in to leave a comment.

Articles in this section