Hi @suneelkumarYX7P2. Yes. Their material can be set similarly to how we set the material of a Part, using its VirtualComponentDefinition.ActiveMaterial property. That property is expecting an 'Asset' or 'MaterialAsset' type object as its value though, not just a String. Virtual components do not reference an external model file, unlike other assembly components though, so they do not contain any materials or appearances of their own.
We also have an opportunity to set the virtual component's material at the moment it is being created, by setting the AssemblyComponentDefinition.DefaultVirtualComponentMaterial property's value before we create the virtual component. That property works the same way, and wants an 'Asset' or 'MaterialAsset' object as its value, instead of just a name. Manually, that property can be found in the 'Document Settings', on the 'Standard' tab within that document settings dialog. So, when you have an assembly visibly open on your screen (as the 'active' document), then go to the 'Tools' tab in the ribbon, then the 'Options' panel should be a button for the Document Settings. If the 'active' assembly is a weldment sub-type of assembly, then we can also set the default material for any 'weld beads' that we create within that assembly, but that setting is actually within the standard iProperties dialog, where there will be a special tab in there named 'Weld Bead'. On that tab are 3 settings...'Visible', 'Weld Bead Appearance', & 'End Fill Appearance'. Then on the 'Physical' tab, at the very top, is where we can set the actual 'material' of the weld beads that get created. Because the weld beads are essentially the only mass adding feature that we can add into an assembly besides components. All the component-based geometry is 'proxy' geometry.
When setting the material of a virtual component, that component only exists within the definition of that assembly, so the material (or appearance) that we specify for it must exist within its parent/owning assembly. Assets primarily exist within external libraries, but we can also create and keep copies of them within our parts directly (usually not in assemblies directly, other than for the two properties mentioned above). So, when we manually assign a material or appearance to something in our part, and that material or appearance is only defined within the 'active' material library, but not in that part, then some automation happens behind the scenes for us to make a local copy of that Asset from the library into the part, then the geometry in the part will directly reference the version of that Asset that exists directly within the part. Any time a model is being set to any material or appearance, that material or appearance must get copied locally into that part first, then it will use that local copy of the asset directly. This eliminates a direct dependency on the external library file. This may be what the error message was talking about, but I can not be sure.
You can check within the AssemblyDocument.MaterialAssets collection for local copies of material type assets, or within the AssemblyDocument.AppearanceAssets collection for local copies of appearance type assets, or just within the general AssemblyDocument.Assets collection, where both types can reside. The general Assets collection object also gives us the ability to 'add' (create) a new asset, if we know one does not already exist the way we need it. But before creating new assets, it is always best to check within the available material libraries first, because it is easier to copy an existing one, than to create a new one.
Application.AssetLibraries
Application.ActiveMaterialLibrary
Application.ActiveAppearanceLibrary
And by the way, the same library file can contain all types of assets: material assets, appearance assets, physical assets.
Wesley Crihfield

(Not an Autodesk Employee)