Are linked files supported in an ASP.NET 1.1 project? - asp.net

Is there a way to have linked files in an ASP.NET 1.1 project?
What I did was to copy the linked file declaration from a DLL csproj to the file I want. But everytime I change the Web.csproj to add a new file, the links are deleted.
Is there a possible workaround? maybe inserting this in the build scripts or something like that?
Is this possible in .NET 2.0?

If you are using Visual Studio 2003 then linked files are not supported:
If you want to explicitly add an item as a link, you can create links
in the following projects:
The solution, Visual C++, and other similar projects support only links, so all of the items in these projects are links. The project
does not attach a link indicator (a small arrow) to the item icon in
Solution Explorer.
Visual Basic, Visual C#, and other similar projects can accommodate both linked and physical project items. Linked items in these projects
display a link indicator attached to the icons of linked project
items.
Visual Basic Web, Visual C# Web and other similar projects, do not
support links to items
http://msdn.microsoft.com/en-us/library/9f4t9t92(v=VS.71).aspx
You can work around this by creating a symbolic link (symlink) to the first instance of the file. The Link Shell Extension makes it easy to do so in Windows Explorer and it will even add an arrow badge to the file's icon (you have to use NTFS). Or use the command line program mklink:
> cd Project\Properties
> mklink AssemblyInfo.cs ..\..\Global\AssemblyInfo.cs
When you have created a symlink, it's as if the same file exists in both places. It's transparent to applications, including (I expect) Visual Studio 2003. This is not the same as a shortcut (.lnk file).

UPDATE: what I did in the end was to take another approach. I simply put a validation in my build script that if the csproj does not contain any reference to my AssemblyInfo files, the build failed.
This was ok because the only time they would be deleted, is when the csproj gets modified which is almost never.

Related

Cannot rebuild ASP.NET Web Applicaiton missing solution file

I am taking over an ASP.NET Web Application using C# and all the code (including C# source) was given to me without the solution file (something.sln) so whenever opening the Web Application in Visual Studio 2017 I have to open by "Folder..." instead of by "Project/Solution...". Once open, I am able to make the necessary changes to the code behind files such as Default.aspx.cs or somethingElse.aspx.cs, but when I try to test the code changes by going to Run > Start Without Debugging, I couldn't find the Run menu option; I see the Build Solution button but it's disabled (greyed out).
Every time I try navigating directly to my site at http://dev.mydomain.com. The code changes I made did not get compiled neither.
So how do I get the Run or Build menu option enabled?
The easiest way to correct this issue is probably to create a new, empty ASP.NET WebForms project (and a new solution file as well if necessary) and copy your code files into it. You can then tell Visual Studio to "include" those files in the project.
You may (or may not) need to make the odd other minor adjustment too but those basic steps should get you started.
Not sure if this is related, but adding the sln file to the git ignore removed its visibility from VisualStudio. I had to open the project csproj file in VisualStudio.
THen on close, the prompt was asking me to save a new SLN file with the same solution name i was looking for. I was then able to go to the directory with the original solution in it, and then I was able to open it again in Visual Studio.
For all those who come to this post in the future, I would check your gitignore files and see if they ignored the sln file.

Visual Studio 2015 CSS Intellisense Broken

Editing cshtml files, I'm used to getting Bootstrap intellisense, regardless of what classes I've already used in said file, like so:
Originally, I thought it was just Bootstrap intellisense, but it appears that this is affecting all CSS for my new project. I can link to the CSS files, directly reference the layout file, it doesn't matter. The Bootstrap and other CSS classes do not show, unless I've already used them in the same file:
I've tried to minimize the differences between the two projects, but to no avail. They are on different machines, in different solutions, but everything else is virtually exactly the same. Here's what I've checked/tried so far.
Delete the project, re-add it.
Remove the Bootstrap Nuget package re-add it
Remove the Bootstrap Snippet Pack, Glyphfriend, Web Essentials 2015.2 extensions, re-add them.
Delete the bin and obj folders, build, clean, rebuild, close/reopen VS, restart Windows.
Deleted this folder to allow for recreation: C:\Users\MyUserName\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
Both machines are running VS 2015 Update 2.
Both projects are MVC 5.
Installed all updates possible in Nuget Package Manager
Known differences
- The machine it works on is running Windows 7, the machine it doesn't is running Windows 10.
I've run into this problem again and found a solution! I'm not sure if it's the same as the original problem I had, but here's the fix anyway.
If the solution has a SQL project (.dbproj), unload it (right click > unload project). There's some weird bug in VS2015 with Bootstrap and SQL database projects that make intellisense for Bootstrap stop working.
In order to get "Class" IntelliSense in VS 2015, try this method. It works for me as follows:
Ex: Right click on any .aspx file in "Solution Explorer" of VS then select "Open With" option then from the list select "HTML Editor" option. Now try to check.
Thanks
Ali

Use script files from another project inside same solution

I'm trying to use some script files between different projects. I have one solution with four projects. In the project "A" I have some scripts like Jquery, Javascript Plugins, etc, and i want to use them on the project "B", by adding a scriptmanager, or anything that works. What can i do this?
I'm using Visual Studio 2010.
Here is a printscreen with my environment.
[EDIT]
Hello, after doing what #CStick says, a have now the scripts in my other project, so a can't add them to a ScriptManager. The problem is path not found on Asp.net code. It cant find the script cause they're placed in the other project. What can i do to solve it?
I know this is old, but for future reader i post an answer.
You will have to use "Link project file" for this.
From the target project, right click on the folder you what the file to be
Select add -> Existing file
Browse to the file you need then click on the arrow at the right of the add button and select add as a link
After this you can modify the file in booth project, but the fille will be only in the source physical location until you publish the project.
This can cause problem for client side file, like script file, on debug because you cant view the file because it's not physically in the target project.
You can use MsBuild to copy the source file on the target directory on build.
(See this answer)
In short, you will create a .targets file then add a reference in your project file.

Where the data-tier application version number is stored in a Visual Studio project?

I have an utility which fills version numbers in AssemblyInfo.cs files. Now I need to implement a functionality to adjust version numbers for Visual Studio Data-Tier applications (DACPAC).
I see that I can adjust the number manually if I open project properties and click the Data-Tier application Properties button. But I cannot find where this number is stored in project files, so I have no idea how to update it automatically from my utility.
Do you know, where is the version number stored?
The properties do not appear in the .sqlproj file unless you change them from their default values. When you do they will appear as follows:
<DacDescription>This is my description</DacDescription>
<DacApplicationName>Database.Application.Name</DacApplicationName>
<DacVersion>1.2.3.4</DacVersion>
The dacpac version number doesn't appear to show up until after the first successful project build. After that however, it shows up as in .sqlproj file as shown below.

recover project in visual studio 2010

i have 4 project in my solution, framework , domain objects,business objects and website ...
but this morning website project couldnt be loaded... when i tried firsttime to open solution... "The solution file has been modified outside the enviroment" message seemed and press reload then error is project file is corrupted... how can it happen... how can i fix this...
thx..
One way... if its from some source control , get the latest and leave the changed part by you.
If you dont have any source control then you can have the two options
- Create a new solution and add all your projects to it and rebuild it. Check for the errors.
- If your code is completely corrupted and files are unreadable, that is unrecoverable,
then you must have to follow this
copy the projects dlls out of bin
dir,
use red gate reflector and extract
all the class file in new project
file.
Now for aspx.cs you can create a new
project add all aspx file in that new project and also the
new cs files generated by the reflector addin. Do it for all pages. When done , right click on Project of web app(if its), then choose convert to web application. Also check the Page header of each page that they are using the same class files.
I know this is little bit tough , but will work....to recover almost that much code, when your app was last compiled.
Note : Also you will have to maintain the hierarchy of the project as the reflector add in (FileGenerator on Codeplex) might miss the actual project hierarchy.
You can open your solution file (.sln) in notepad and check for the consistency of the document.
The sln file will be in a hierarchical structure (like we have an xml).
You can also open csproj files of different projects that you have in the solution check the xml of the csproj.

Resources