Solution file opens up precompiled code in Inetpub - c#

I have a folder that contains ASPX code and its codebehind (C#) as well as a solution file. The compiled version of the application resides in the inetpub directory.
Whenever I open the solution in Visual Studio, VS warns me that it is attempting to open a precompiled website and asks me if I want to continue. If I click NO it does nothing, but If I click yes it shows me the ASPX files in the inetpub directory.
How do I make the solution work with that code in the directory that it is in (ie with the aspx and codebehind)?
Thanks

Sounds like this solution was created by going to File->Open->Web Site and then saved afterward. In orther words, this is not the original solution file.
I suggest simply creating a new solution. Add the exisitng .csproj if appropriate (ie, you have a Web Application Project), or the existing web site from the directory your code is in.

Before you open your solution try opening your .sln file in Notepad or some other editor and double check that your web site path is right.
Debug.AspNetCompiler.VirtualPath = "/Url..."
Debug.AspNetCompiler.PhysicalPath = "Physical Path from the solution file\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\this might be the same as your physical path?\"

Related

VS 2015 - Created solution folders are not appearing on file system

I think this is a known problem with real folders and solution folders in visual studio. I'm facing now the same issue. I got a project handedover from other developer and he already created, directly under the solution some folders and sub folders. All these directories and sub directories are appearing in visual studio solution explorer and also on the file system. As I mentioned, I'm using VS 2015. Here a screenshot:
I have no idea how he did this or if he used any tool for that.
When I try to create a sub folder under SQL-Scripte folder and add some files to it, then the added files are appearing directly under the solution directory. See this screenshot:
Any help is highly appreciated :).
Thanks!
Actually the folders that you create as solution folders, are virtual ones that you cannot see on the file system. To be able to see the folders on both sides (VS and file system), I managed to fix this with the following work around:
1- Create a solution folder (let us name it newSql) under your SQL-Scripte folder
2- Add the files to it.
3- You will notice that the files are located directly under your solution folder in the file system. Exactly as you mentioned in the second screenshot.
4- Now close your visual studio and navigate to your solution directory.
5- Create under the folder SQL-Scripte (on file system), a folder named newSql and copy the files from your solution directory (in your case the SQL file that starts with 1.17....) to this newSql physical system folder.
6- Then open your (.sln) file with Notepad or Notepad++
7- Locate the entry for the new added newSql folder and there change the path to point to your new file system newSql folder. Like this: SQL-Scripte\newSql\1.17.sql
8- Save and again open VS. If you are using TFS then you should right click on the 1.17.sql file and click add to source control and check in.
Like this, you will see the folder on both sides and you can manage it only from VS.
Hope it helps.

Import ASP.NET Page to Existing ASP.NET Project

I am new to ASP.NET and I was asked to create a portal program which will be just a part of the existing ASP.NET portal project. Meaning, it will be just like 2 web pages and will be going to be added to the existing project. The thing is I have to do it in a separate ASP.NET Project file. I have the source code of the existing main project but I am not allowed to modify this unless the pages that I will develop are completed. How can I do it? I know I just have to create a new project but what is the next step after that? How can I import the one that I made to the main project? They mention that I just have to export it as DLL but I have no idea how to do that. Please help me.
Open your new project in Visual Studio.
Open the old project in Visual Studio.
Right click the name of your new project on Solution Explorer, select Open Folder in File Explorer
Copy the 2 new pages you created
Go to the Visual Studio Instance of your old project. Click the name of the solution and CTRL + V or Right Click > Paste. (If there is a folder let's say Pages where ASPX files are located, click and paste there instead).
Your new files might not be included in the project and if its happens, click the 'Show all Files' option on the Solution Explorer.
Right click on the 2 new ASPX files and select 'Include In Project'.
I am not sure if I understood you right. If you just have to export the dll from the project that you created, right click on your solution, open the bin folder, you will see a file named yourprojectname.dll. Copy this to your target projects bin folder using the steps mentioned above.
If I understood it right, you are being asked to created a classlibrary or something and not an aspx page. Again, I might be wrong, but others can help you if you are lucid about your requirement.

Shared folder in ASP.NET MVC 4 project is hidden

For some reason, my shared folder ,which contains some error pages and my master _layout.cshtml page, is hidden. I can only access it when I click on show all files in my solution explorer. This is not a real problem, everything still works but I know this is not standard.
I don't know how this folder became a hidden folder, but does anyone know how to set the folder visible?
When I browse to my project folder in my file system, the folder is not a hidden folder...
I use Visual studio 2012, os = windows 7 64 bit
Just a wild guess here, but can you right click it (in Visual Studio) and "Include In Project"?
It will not be included in your .csproj file.
To include it, either open your .csproj file in notepad and add in the lines or remove the folder from the project and add it back in.

How to add external file outside the application folder to clickonce deployment (winappliction.net) [duplicate]

I've got an application that I'm moving over to ClickOnce and the app has a moderately sized data folder with hundreds of files that I need to inlcude in the deployment. The folder needs to be in the same place relative to the EXE after deployment. I've seen several suggestions on how to do this but there doesn't seem to be a agreed upon method for doing this.
Any suggestions would be great -
Thanks!
One good way of doing this is:
Create a folder under the app in VS name e.g. "datafiles"
Add all files to that folder using Add as link in the dialog box after selecting Add existing item on the folder
Mark all files as Copy if newer (Copy to output directory property)
Make sure the build action is content
--> when you publish the files will be put in that folder and be a part of the application installation
Good luck!
After deployment, all files marked as data are placed in the ApplicationDeployment.DataDirectory folder. I know of no way to change this. You could copy the data files during the first run of your app, but this approach will not survive any upgrades that include data file changes.
Alternatively if you have control over the location of the data folder during development, you can place in the same relative (to the app folder) location as will be specified after deployment.
https://msdn.microsoft.com/en-us/library/kzy0fky2.aspx
https://msdn.microsoft.com/en-us/library/6fehc36e.aspx
These two articles provide methods of doing this. Between the two of thing you can find one that works for you. The one that worked for me was:
With a project selected in Solution Explorer, on the Project menu,
click Properties. Click the Publish tab. Click the Application Files
button to open the Application Files dialog box. In the Application
Files dialog box, select the file that you wish to mark as data. In
the Publish Status field, select Data File from the drop-down list.

Error: Could not download silverlight application. Check web server settings

Developing a silverlight page in already existing web application for previewing video files. When I create a asp.net application locally and add silverlight application on the solution it works perfectly. But while I am trying to include into already existing project it throws this error. I have not deployed into the IIS. this happens while debugging.
Check the path to your xap file in your webpage. It should be something like:
/ClientBin/my.xap
Also ensure that your xap file is actually in the ClientBin folder. In the web application Properties, choose the Silverlight Applications tab and add the silverlight project to the list.
Although probably not applicable in your case, this can also occur if you are using iis and haven't registered the correct mime type for .xap files. It should be set to application/x-silverlight-app.
This is little same with another answer, but I give my detailed solution with image of setting.
In my case, one of my aspx page will load Zip and Xap files under ClientBin Folder, normally it'll load 20 Zip/Xap files under ClientBin\,
But I found that when building/publishing the project, the Zip/Xap files are NOT output to ClientBin\, that is ClientBin folder is nearly empty.
So my solution is to let the Zip/Xap files output to ClientBin\, to do this, the setting way can see this article:
https://social.msdn.microsoft.com/Forums/silverlight/en-US/d8e2c92a-4b31-4e4b-a440-4960a8d475b4/how-to-generate-xap-file?forum=silverlightstart
Besides here is the screenshot of my setting, that is Right click at your Silverlight project > Properties > Silverlight Application, and you can click the Add button to add content,

Categories

Resources