function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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/
vishal Vishalvishal Vishal
mod apk download (https://apkduniya.com)
tech lifetech life
I read your blog post and this is nice blog post.. thanks for taking the time to share with us. have a nice day.Happy Holi wishes 2020 (https://messagewishes.com/happy-holi-wishes-messages-greetings-status-hd-images/)  --Message wishes (https://messagewishes.com/)
tech lifetech life
Thanks For valuable post sharing.-Worldfree4u (https://www.onhandtrick.com/worldfree4u-new-movies-download/)  Onhandtrick (https://www.onhandtrick.com/)