Include created folders In Project - c#

I am working in an application that grapes real time data and stores them inside my project directory as excel sheets inside folders. My output folders are stored under bin\Debug. I click on show All to be able to see them. Is there a way to include these output folders programmatically?

Do you mean including the files in the project ? If so, you can do it by editing the project file. Project file (.csproj) is just a plain text file. First add a file and see how it affects the csproj file. After that you can programatically edit the csproj file to include the files you want.

Related

Build folder contains a dll file that causes issue

I only want the autofib.dll file in the folder
Before I added a new package this would never be outputted to the folder, is there a way to store those two files from appearing in the folder when I build the project as I only want autofib.dll in there.

Nuget post build event - adding files to path inside .nupkg

I'm posting this here since I haven't been able to get any help from nuproj's github page.
I have some files I need to write to a specific path in my .nupkg file. After a successful build, I would like to place several files into a specific path (runtimes/win7-x64/native) instead of the default 'lib/net45' folder.
Right now, I have to open the .nupkg file (I use Nuget Package Explorer) and manually create the (runtimes/win7-x64/native) folder structure then add the appropriate files. Note - these files have to be in this specific path in order for them to work in my project.
Basically, how do I go about using nuproj to handle this for me and eliminate the need for me to do it manually? I've attached an image to better illustrate my question (the part in red is what I'm trying to automate).
You could edit the nuspec file and set the folder path for the target.
How to add a folder to a nuspec file
And then create the .nupkg file with the edited nuspec file in command line.
http://www.hanselman.com/blog/CreatingANuGetPackageIn7EasyStepsPlusUsingNuGetToIntegrateASPNETMVC3IntoExistingWebFormsApplications.aspx
And then you could add the command line to the post-build event.

c# Excel AddIn, find content file path when excuting

I am using VSTO to build an Excel AddIn. In this project, I also added some python .py scripts to do some data manipualtion.
The whole project is a C# project, all the .py files are taken as content files of the project, in detail, what I did is setting Properities-Build Action as 'Content', setting Properities-Copy to Output Directory as 'Copy always'.
However, after publish with clickonce, when executing, I couldn't find where the content files are. I already tried like: Application.StartupPath, but did't work. I really need to find the content files path and step into them.
Thanks in advance to anyone who take time to see my question.
Publish page of an office add-in project doesn't have an Application Files button which means you can not include some files in the click once installer in the way that you do it for applications. As an option, you can put your files as embedded resources and then at startup of the add-in, extract them from resources and copy them to add-in output directory.
To do so, you can add your file to Resources.resx and then at StartUp of your add-in, extract the file from resources and save it to the deployment directory and use it.
var assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
var assemblyFolder = System.IO.Path.GetDirectoryName(assemblyLocation);
var file = System.IO.Path.Combine(assemblyFolder , "test.py");
if (!System.IO.File.Exists(file))
System.IO.File.WriteAllBytes(file, Properties.Resources.test);
Now the file is in the path specified in file variable.

How to add file into Appx directory

I've 2 folders visible in Solution Explorer in my project (sample grid app):
fasdalocation and fasadalocation2.
fasadalocation was previously oryginal DataModel folder in sample grid app, fasadalocation2 is folder created by me.
Two folders contain identical file: SampleData.json.
I can acces to json file from fasadalocation by
Uri("ms-appx:///fasadalocation/SampleData.json")
unfortunatelly this don't work for fasadalocation2 (I got FileNotFoundException).
It's caused by fact that
C:\Users\Jakub\Documents\Visual Studio 2013\Projects\sample grid app\sample grid app\bin\Debug\AppX
location doesn't contain fasadalocation2.
How can I add fasadalocation2 into appx?
Of course I thought that simple insertion folder into AppX location isn't a gentle solution...
It looks like the 2 files are content files that need to be deployed to your output folder and one of them does not have the correct build action to copy it to the folder.
Right click on SampleData.json in the fasadalocation2 folder and ensure it's build action is set to Content and CopyAlways.

deploy a csproj file in c# project?

I added 3 html files to my project and the change is reflected in my csproj file.
But to deploy this on to a web server, is it enough if I drop these 3 files in the appropriate directory? Or is there any build/assembly deploy needed because of csproj change?
Html files do not require build, just copy the files
IF you have code behind for aspx files then you need to deploy the dll.
Add the file to your project.
Set the build action to "content".
Set "copy to output directory" to "copy always".
The file should be included in the same folder as the rest of your deployment. You should be able to see it by building it and looking in the \bin\release or the \bin\debug folder. If it's not there, click on the Application Files button and see if it shows up there.
Deploying the HTML files to your web server simply requires you copy the HTML files to the appropriate directory.
The resulting change in your .csproj was really only made to keep track of the files within your IDE but no, you wouldn't need to rebuild/redeploy the resulting DLL just for static files.

Categories

Resources