<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: can vs insert a dwg file as a vs resource? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339862#M24171</link>
    <description>&lt;P&gt;Great with helpfull your post, It'd work after I create a new project from "Autocad Plug-in template C#" and install the&lt;STRONG&gt; Microsoft.CSharp &lt;/STRONG&gt;Nuget package 4.7.0&lt;/P&gt;&lt;P&gt;So many thanks with your support &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt; . I learn a lot of thing from your posts &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kinakira2013_0-1621996069677.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/922902i26E83800D72FA481/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kinakira2013_0-1621996069677.png" alt="kinakira2013_0-1621996069677.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 02:28:10 GMT</pubDate>
    <dc:creator>KinAkira</dc:creator>
    <dc:date>2021-05-26T02:28:10Z</dc:date>
    <item>
      <title>can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/8422634#M24159</link>
      <description>&lt;P&gt;I have many dwg blocks.&lt;/P&gt;
&lt;P&gt;in my program, I will use them, but I do not want user see the dwg blocks in the folders.&lt;/P&gt;
&lt;P&gt;so my question is, can vs import a dwg file into the resources, just like the jpg file.&lt;/P&gt;
&lt;P&gt;and how to use the resource dwg file in vs c# code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Nov 2018 07:28:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/8422634#M24159</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-11-25T07:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/8423607#M24160</link>
      <description>&lt;P&gt;When you embed a DWG file as resources, it&amp;nbsp;usually&amp;nbsp;is extracted into memory as byte array. Since AutoCAD .NET API do not have method to use byte array/memory stream directly as DWG file, you need to firstly save it to disk before using it as DWG file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the example code (where I embeded a block DWG file "MyBlock.dwg" as a resource item called "MyBlock"):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System.IO;
using Autodesk.AutoCAD.Runtime;
using CadApp = Autodesk.AutoCAD.ApplicationServices.Application;

[assembly: CommandClass(typeof(DwgAsResources.MyCommand))]

namespace DwgAsResources
{
    public class MyCommand 
    {
        [CommandMethod("ExtractFile")]
        public static void RunDocumentCommand()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            var ed = dwg.Editor;

            try
            {
                var blkFile = ExtractFileFromResource("MyBlock");
                if (!string.IsNullOrEmpty(blkFile))
                {
                    //Use this drawing file from AutoCAD's temp file location
                    // such as insert this block file into current drawing
                    CadApp.ShowAlertDialog(
                        "Block file saved in project resources has been extracted!");

                    File.Delete(blkFile);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: {0}", ex.Message);
            }
            finally
            {
                Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();
            }
        }

        private static string ExtractFileFromResource(string resourceName)
        {
            dynamic preferences = CadApp.Preferences;
            string filePathName = 
                (string)preferences.Files.TempFilePath + "\\" + resourceName + ".dwg";

            try
            {
                var bytes = (byte[])Properties.Resources.ResourceManager.GetObject(resourceName);
                if (File.Exists(filePathName)) File.Delete(filePathName);
                using (var stream = new FileStream(filePathName, FileMode.Create, FileAccess.Write))
                {
                    stream.Write(bytes, 0, bytes.Length);
                    stream.Close();
                }

                return filePathName;
            }
            catch
            {
                return "";
            }
        }
    }
}
&lt;/PRE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 04:55:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/8423607#M24160</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2018-11-26T04:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338124#M24161</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;When you embed a DWG file as resources, it&amp;nbsp;usually&amp;nbsp;is extracted into memory as byte array. Since AutoCAD .NET API do not have method to use byte array/memory stream directly as DWG file, you need to firstly save it to disk before using it as DWG file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the example code (where I embeded a block DWG file "MyBlock.dwg" as a resource item called "MyBlock"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        private static string ExtractFileFromResource(string resourceName)
        {
            ...
                var bytes = (byte[])&lt;BR /&gt;                    Properties.Resources.ResourceManager.GetObject(resourceName); // Error
            ...           
        }
 &lt;/PRE&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt; ,&amp;nbsp; I pasted your code hower It didn't work because It'd a error at above command line.&lt;/P&gt;&lt;P&gt;Could you please help me fix this error?&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 14:06:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338124#M24161</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-25T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338222#M24162</link>
      <description>&lt;P&gt;Well, my code did have a minor bug (but it still works with it, at least with my Acad2020/2021) here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;string filePathName = 
                (string)preferences.Files.TempFilePath + &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"\\"&lt;/STRONG&gt;&lt;/FONT&gt; + resourceName + ".dwg";&lt;/PRE&gt;
&lt;P&gt;should have been (i.e. extra backslash):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;string filePathName = 
                (string)preferences.Files.TempFilePath + resourceName + ".dwg";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Other than that, the code work OK and this line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var bytes = (byte[])Properties.Resources.ResourceManager.GetObject(resourceName);&lt;/PRE&gt;
&lt;P&gt;works as expected, as long as the resource name is correct, again with my Acad2020/2021, and I believe also with my Acad2018 when my original reply posted. So, I am not sure what help I can offer here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 14:34:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338222#M24162</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-25T14:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338557#M24163</link>
      <description>&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Unfortunately&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;, It's still not working with me. I attacked my project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kinakira2013_1-1621960117505.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/922707i63D5F3DE3E45E073/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kinakira2013_1-1621960117505.png" alt="kinakira2013_1-1621960117505.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 16:30:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338557#M24163</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-25T16:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338762#M24164</link>
      <description>&lt;P&gt;I went to try this, and visual studio shows the acad references as not found.&lt;/P&gt;&lt;P&gt;I have 2020 installed, that is not it. The project file has like this:&lt;/P&gt;&lt;P&gt;&amp;lt;Reference Include="AcCoreMgd"&amp;gt;&lt;BR /&gt;&amp;lt;SpecificVersion&amp;gt;False&amp;lt;/SpecificVersion&amp;gt;&lt;/P&gt;&lt;P&gt;While my projects typically have&lt;/P&gt;&lt;P&gt;&amp;lt;Reference Include="accoremgd"&amp;gt;&lt;BR /&gt;&amp;lt;HintPath&amp;gt;C:\Program Files\Autodesk\AutoCAD 2019\accoremgd.dll&amp;lt;/HintPath&amp;gt;&lt;/P&gt;&lt;P&gt;which is version specific of course.&lt;/P&gt;&lt;P&gt;Besides editing the project file, how do I tell VS where to find the acad dll's in this case?&lt;/P&gt;&lt;P&gt;I've always made a different project for every version, so this sounds like something I have been missing.&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 17:38:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10338762#M24164</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-25T17:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339018#M24165</link>
      <description>&lt;P&gt;You should have indicated that the error you get is compiling error, not runtime error. Here is what I imagined what happened with your code:&lt;/P&gt;
&lt;P&gt;1. You added a drawing into the resources;&lt;/P&gt;
&lt;P&gt;2. You copied the code prom my post and pasted it inti class "myPlugin" and tried to build it, and got error on "Properties" are not defined/declared.&lt;/P&gt;
&lt;P&gt;3. You add a static public member "Properties" of object type to the class "myPlugin";&lt;/P&gt;
&lt;P&gt;4. Still the code does not compile.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course it does not compile: you defined a "Properties" member, but never instantiate it, not to mention it does not have a property "Resources" magically by itself!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Properties is a namespace automatically added to your project's namespace by Visual Studio when you added settings/resources to the project, i.e. [your project namespace].Properties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It turns out it is a simple typo/mistake that we as programmer often overlook even stared at it straightly: your "myPlugin" class has different namespace from the namespace of the project:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the project (thus the Properties):&lt;/P&gt;
&lt;PRE&gt;Autocad_2020_plugin_&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;020&lt;/STRONG&gt;&lt;/FONT&gt;_Read_Data_from_Resources
&lt;/PRE&gt;
&lt;P&gt;for "myPlugin" class:&lt;/P&gt;
&lt;PRE&gt;Autocad_2020_plugin_&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;021&lt;/STRONG&gt;&lt;/FONT&gt;_Read_Data_from_Resources
&lt;/PRE&gt;
&lt;P&gt;So, you need to change the "_021_" to "_020_" and remove this line(!!!):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;public static object Properties { get; private set; }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes, a simple/stupid mistake we made may cost us hours to find it out, when working too hard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 19:06:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339018#M24165</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-25T19:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339249#M24166</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yah, when people post their whole project without indicating where it puked during debug, its not a good sign.&lt;/P&gt;&lt;P&gt;Any chance you know the answer to my question on the references?&lt;/P&gt;&lt;P&gt;I should post that as a new topic really...&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 20:43:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339249#M24166</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-25T20:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339368#M24167</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/296193"&gt;@JamesMaeding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not recall I even needed to open project file to see the references.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case (of VS showing acad reference not found), could you just manually remove and re-add the referenced assemblies of correct version? Also make sure the .NET framework is set properly (if you somehow set the project to use very old version of .NET Frameowrk?). Of course to make sure "Copy Local" is set to false. If all these done correctly, I do not see why VS would not found Acad references... unless you made the same mistake as I pointed out in the other reply to the OP: there is typo in the namespace directive in the class file, so classes are not in the same namespace, thus do not see each other unless fully qualified class name is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 21:35:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339368#M24167</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-25T21:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339425#M24168</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as making things work, I absolutely could just get in and assign the hint path.&lt;/P&gt;&lt;P&gt;I do that every time a new acad version comes out.&lt;/P&gt;&lt;P&gt;I'm thinking I am missing something about how VS works though.&lt;/P&gt;&lt;P&gt;Somewhere it has to know where to look. I got the whole solution from the OP, and was thinking it would be in the project, solution, or some config file. My VS is not finding the reference though.&lt;/P&gt;&lt;P&gt;I did a new post on this just now, so likely better to reply there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, My world continues to benefit from your past posts, especially the separate thread progress bar one.&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 21:57:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339425#M24168</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-25T21:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339679#M24169</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;So, you need to change the "_021_" to "_020_" and remove this line(!!!):&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;public static object Properties { get; private set; }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes, a simple/stupid mistake we made may cost us hours to find it out, when working too hard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt; , I modified my code follow your advices. But now, The error occurs at "&lt;STRONG&gt;Properties&lt;/STRONG&gt;..." line; when I replace "Properties" to "&lt;STRONG&gt;Autocad_2020_plugin_020_Read_Data_from_Resources&lt;/STRONG&gt;" &amp;gt;&amp;gt; This line has no error; however an error appeared at "&lt;STRONG&gt;filePathName&lt;/STRONG&gt;" declared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kinakira2013_0-1621989045678.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/922874iB5E20D622E5A7194/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kinakira2013_0-1621989045678.png" alt="kinakira2013_0-1621989045678.png" /&gt;&lt;/span&gt;&amp;nbsp; &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kinakira2013_1-1621989115669.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/922875i25E1EDED549A3209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kinakira2013_1-1621989115669.png" alt="kinakira2013_1-1621989115669.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 00:35:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339679#M24169</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-26T00:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339786#M24170</link>
      <description>&lt;P&gt;I forgot to mention one thing actually:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How did create your DLL project? When you start a new project in Visual Studio and choose C# as the language to use,&amp;nbsp; VS should automatically add Microsoft.CSharp in the references. But your project somehow missing this reference!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to add reference to Microsofr.CSharp to the references. Or, you may want to restart a new project, to void having to blindly fix the mess of your existing project. I have no idea how the project got messed up (missing Microsoft.CSharp reference, wrong namespace of the myPlugin class...), but that is the problem you have!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 01:42:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339786#M24170</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-26T01:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339862#M24171</link>
      <description>&lt;P&gt;Great with helpfull your post, It'd work after I create a new project from "Autocad Plug-in template C#" and install the&lt;STRONG&gt; Microsoft.CSharp &lt;/STRONG&gt;Nuget package 4.7.0&lt;/P&gt;&lt;P&gt;So many thanks with your support &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt; . I learn a lot of thing from your posts &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kinakira2013_0-1621996069677.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/922902i26E83800D72FA481/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kinakira2013_0-1621996069677.png" alt="kinakira2013_0-1621996069677.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 02:28:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10339862#M24171</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-26T02:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10341593#M24172</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the original project posted has acad dll reference errors.&lt;/P&gt;&lt;P&gt;I learned that VS uses either the hint path, or build output folder, or GAC to find dlls, and none of those help here.&lt;/P&gt;&lt;P&gt;I would guess that the build output path used to be the acad program files folder, but got switched somehow. So I'm not losing my mind, or, what's left of it these days...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:01:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10341593#M24172</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-26T16:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10341638#M24173</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10754350"&gt;@KinAkira&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to do these things to get it to compile:&lt;/P&gt;&lt;P&gt;1) rename workspaces to match, including in project properties (I used Readdwg as the name)&lt;/P&gt;&lt;P&gt;2) remove the Properties property line&lt;/P&gt;&lt;P&gt;3) change the line with Properties to:&lt;/P&gt;&lt;P&gt;var bytes = (byte[])ReadDwg.Resource.ResourceManager.GetObject(resourceName);&lt;/P&gt;&lt;P&gt;4) add the csharp reference&lt;/P&gt;&lt;P&gt;5) add hint paths to acad dll references.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then it compiled. Those are basics though, so&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10754350"&gt;@KinAkira&lt;/a&gt;&amp;nbsp;if you can't be comfortable doing those on your own, you are in over your head. I run into this a lot, and wonder how mentorship could be done for those learning.&lt;/P&gt;&lt;P&gt;Forum back and forth is ok, but really someone should be working with you in real time, interactively. If I could figure out how to do that in some affordable way for others, that might be a nice career. Its not that I or others are masters (ok, get the laugh out, go ahead....), but we do know basics and where to look to solve things.&lt;/P&gt;&lt;P&gt;Curious if other have ideas how to provide that real time mentoring without $200 an hour consulting fee.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:19:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10341638#M24173</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-26T16:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10342859#M24174</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/296193"&gt;@JamesMaeding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a newbie in CAD API. I joined this forum not too long ago. So, If my question took your time, I apologize for that. I just wanted my idea to be made reality by myself, so I started with 0 and try to learn whatever I dont know.&lt;/P&gt;&lt;P&gt;Thank for your advices, JamesMaeding.&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 02:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10342859#M24174</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-27T02:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10344763#M24175</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10754350"&gt;@KinAkira&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sounds goo, keep at it. You are hitting two learning curves though, the VS/C# one, and then using it with Autocad.&lt;/P&gt;&lt;P&gt;The better way to do your experiments is have a "starter" program that works with Autocad.&amp;nbsp; Make that starter from scratch, no wizards! If you cannot do that, you are not ready to move on.&lt;/P&gt;&lt;P&gt;I also have test programs for little parts of code, before adding to my big programs.&lt;/P&gt;&lt;P&gt;Then copy those and add little by little. You will eventually learn that part of troubleshooting C# is doing the reverse - removing bit by bit when things won't work.&lt;/P&gt;&lt;P&gt;The other part is setting break points and debugging, but the thing has to compile first.&lt;/P&gt;&lt;P&gt;Look up my posts on how to set up the "run" string for debug. If you make a script to load the dll, then add that to the run params, you can have acad start up, load the debug dll, and its all slick. No hand loading of the debug dll.&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 15:56:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10344763#M24175</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2021-05-27T15:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10346144#M24176</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/296193"&gt;@JamesMaeding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10754350"&gt;@KinAkira&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sounds goo, keep at it. You are hitting two learning curves though, the VS/C# one, and then using it with Autocad.&lt;/P&gt;&lt;P&gt;The better way to do your experiments is have a "starter" program that works with Autocad.&amp;nbsp; Make that starter from scratch, no wizards! If you cannot do that, you are not ready to move on.&lt;/P&gt;&lt;P&gt;I also have test programs for little parts of code, before adding to my big programs.&lt;/P&gt;&lt;P&gt;Then copy those and add little by little. You will eventually learn that part of troubleshooting C# is doing the reverse - removing bit by bit when things won't work.&lt;/P&gt;&lt;P&gt;The other part is setting break points and debugging, but the thing has to compile first.&lt;/P&gt;&lt;P&gt;Look up my posts on how to set up the "run" string for debug. If you make a script to load the dll, then add that to the run params, you can have acad start up, load the debug dll, and its all slick. No hand loading of the debug dll.&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you very much, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/296193"&gt;@JamesMaeding&lt;/a&gt; . Your post is a great advice for me. As you see, I have 20 very small example projects (Autocad_2020_plugin_020_Read_Data_from_Resources) up to now. And I'm going on. I hope I will get supports from you and other guys in the future! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 01:03:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10346144#M24176</guid>
      <dc:creator>KinAkira</dc:creator>
      <dc:date>2021-05-28T01:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: can vs insert a dwg file as a vs resource?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10600450#M24177</link>
      <description>Hi,Yuan&lt;BR /&gt;&lt;BR /&gt;Thank you. The code works very well.&lt;BR /&gt;&lt;BR /&gt;I'm sorry I forgot to accept it.</description>
      <pubDate>Sun, 05 Sep 2021 07:52:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-vs-insert-a-dwg-file-as-a-vs-resource/m-p/10600450#M24177</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2021-09-05T07:52:40Z</dc:date>
    </item>
  </channel>
</rss>

