+ Start a Discussion
Timothy SmithTimothy Smith 

Unexpected file found in package directory: -Received when delploying with VSCode.

I am receiving the error:
Unexpected file found in package directory:
When I try to deploy a class that I have just created.  The file is saved in the /force-app/main/default/classes/Case_Trigger_Alert_Count.

I have also noticed that in the 'Problems' tab, I have the message:
The sourcepath ".../force-app/main/default/classes/Case_Trigger_Alert_Count" is not a valid source file path.  SourcePathInvalid [1,1]

The filename of the file I have just created and attempting to deploy is 'Case_Trigger_Alert_Count"
What am I missing to be able to deploy to my Sandbox?
Best Answer chosen by Timothy Smith
lnallurilnalluri
@Timothy

Ingeneral classes ends with .cls extension. Make sure you have that. Also every class should have meta xml file associated with it. 

For example
 SampleClass.cls
 
public with sharing class SampleClass {
// some code
}

SampleClass.cls-meta.xml
 
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>46.0</apiVersion>
    <status>Active</status>
</ApexClass>

Make sure you class has all these.

Thanks.

All Answers

lnallurilnalluri
@Timothy

Ingeneral classes ends with .cls extension. Make sure you have that. Also every class should have meta xml file associated with it. 

For example
 SampleClass.cls
 
public with sharing class SampleClass {
// some code
}

SampleClass.cls-meta.xml
 
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>46.0</apiVersion>
    <status>Active</status>
</ApexClass>

Make sure you class has all these.

Thanks.
This was selected as the best answer
Amresh mishraAmresh mishra
Amazon prime (https://www.mytargethub.com/amazon-prime-in-hindi/) is just published on my site My target hub.
REKHA SARKARREKHA SARKAR
tech lifetech life
tech lifetech life
Thanks for valuable post sharing.https://messagewishes.com/happy-diwali-2019-messages/