I am new to KendoUI. I have included the binary reference in my project for KendoUI.
I am trying '#using Kendo.Mvc.UI' in a View inside app_code.
Visual Studio can't find reference.
It works fine outside app_code.
You have to set the Build Action of the .cs file to Content instead of Compile
If you want to read more about the build actions here
Updated
The following are some common build actions.
None: The file is not included in the project output group and is
not compiled in the build process. An example is a text file that
contains documentation, such as a Readme file.
Compile: The file is
compiled into the build output. This setting is used for code files.
Content: Allows you to retrieve a file (in same dir as assembly) as
a stream via Application.GetContentStream( uri ). For this method
to work, it needs a AssemblyAssociatedContentFile custom
attribute which VS graciously adds when you mark a file as
“Content”
Embedded resource: embeds the file in an exclusive
assembly manifest resource.
Note: WPF have some additional build actions, but the above are the essential build actions and it will do the trick.
Related
Context: setting up the Assembly Name/Default namespace in the Project Properties (right click on project, Properties, Application tab; or edit the .csproj).
I would like to add a parameter there to explicitly have them following the Project Name, plus some custom suffix. So if I rename my project, the Assembly name/namespace follow that rename.
Example: project named foo → foo_suffix.dll. If I rename the project to foo1 → foo1_suffix.dll.
Same behaviour for the namespace.
Reading Common macros for MSBuild commands and properties,
I tried inputting $(ProjectName) both in VS and in the .csproj file, but I get a .dll named exactly like that.
How can I get this done?
How can I get this done?
1. Try using $(MSBuildProjectName) property from this document.
You're developing a C# project(csproj) while your document above is about macros in C++ projects(vcxproj). So I think $(MSBuildProjectName) property can be more suitable for you after my several tests.
(I tried $(ProjectName), but it only worked well when I set something like <AssemblyName>$(ProjectName)</AssemblyName>, if I add a suffix like $(ProjectName)_suffix, the output sometimes is _suffix.dll. But it always work well if I use $(MSBuildProjectName)!)
I get the desired behaviour, but that is inconsistent with what I can
see in project, Properties, Application tab.
2. Try reloading the project file(Right-click project, unload.., reload...) to Update the UI.
From your comment, it seems like the $(ProjectName)_suffix works well in your machine? If so, you can still use $(ProjectName) property.
What you experienced is expected behavior for Msbuild and VS. VS will read value from csproj during project loading process. Then it display the related value by UI.
So after we rename the project name and then build the project, we can get a ProjectName_suffix.dll in output folder. But the UI is still not changed(inconsistent), cause now we need to Update the UI.
You can right-click project node, unload the project=>reload the project to get UI updated. And now the output xx.dll can be consistent with what you see in project, Properties, Application tab. It needs us to reload the project each time after you rename the project, then the UI would be consistent with your xx.dll. And actually it won't affect your build though the UI is not updated, the output can be your desired behaviour.
3. All above is more related to the relationship between Assembly Name and Project Name. One point you should know is msbuild(csproj) won't modify the source files(xx.cs) after the project is created.
So assuming you have a Class1.cs file whose namespace is Library. If you rename the project to NewLibrary, reload the project and you can see the Namespace is NewLibrary now in project, Properties, Application tab. But the namespace for Class1.cs file is still old Library. This is expected behavior in VS, and the new NameSpace NewLibrary would work if you create a new xx.cs file.
Hope all above helps :)
I created a new Blank Node.js Web Application in Visual Studio 2015, and I'm unable to add .tsx files to my project and compile them. When I do so, the created .tsx file is put into a Virtual Project instead, even though it is present in the actual project as well. The project is set to compile JSX expressions as React calls.
It took me some time to track down what's happening behind the scenes, and what happens is that when a .tsx file is created in the project (through Add -> New File), it is created as a Content entry in the project's XML file, instead of a TypeScriptCompile entry. This is clearly an error.
I can fix the issue by manually editing the project's XML file, but no way I'm willing to do that for actual production in 2016, with hundreds of files.
Step-by-step guide to reproduce the error
Create a new Blank Node.js Web Application project
Create a new .ts file in the new project
Create a new .tsx file in the new project
See that the displayed "host project" of the .tsx file (check the top-left corner of the editor window) says "TypeScript/JavaScript Virtual Projects".
How can I make it so that .tsx files are included in the project exactly how .ts files are?
Edit
This is not a problem with a HTML Application with TypeScript project, but that project type contains a lot of unnecessary C# bloat that I don't need.
I can fix the issue by manually editing the project's XML file, but no way I'm willing to do that for actual production in 2016, with hundreds of files.
This has to do something with the project template, and is likely a bug. A possible workaround in the meantime is creating the new file as a .ts file, and then renaming it to .tsx.
I have a console application that I've been developing and I'm just about ready to publish it for consumption.
However, there's a file that the app needs to reference (a couple files actually) and I'd like to try to include these either during install logic or via an outside process. Here's the situation:
The application fires off a load test based on some criteria the user chooses. The load test is defined by a .loadtest file which is created outside of this project.
So what I would like for the installer to do is contain the .loadtest files and just shove them in a default directory that the project can reference.
I can't figure out how to add this specific file as a pre-requisite or anything though, in the publish wizard. Any ideas?
When you add a file to the solution, it does not automatically get attached as part of the build in some cases. If you right click the file in your solution explorer and select "Properties", change the build action to "Content". This will ensure that VS includes the file as part of the build/publish and places it in the output directory of the build process.
We have a project (C#) which has been added to source control (TFS 2010), however one of the project files is anauto generated one and as such we dont want it under source control.
Is there a way to remove the source control association for this single file in the project?
Please note the autogenerated file is made from a custom XML document using an internal standalone tool. Whilst I appreciate a long term solution to this issue would be to not have the file linked to the project, but to include the source XML document and have it associated with an appropriate custom tool to generate the C# file at build time. Sadly creating said custom tool is not going to happen in my immediate future hence the query about dissacociating the generated file that is in the project from the projects TFS source control.
Open up the project and select the file.
On the VS menu go to: File -> Source Control -> Exclude FILE_NAME From Source Control
I'm using code generation and would like to automatically add the newly generated files into the project file after the generation is complete. If I add the files by modifying the project file, they don't get the plus icon next to them like when add them through the IDE. As a result, they don't get added to source control when I check the files in.
Is there a way to programmatically add a file to a project file in a way that will make it have the plus icon next to it to add it to source control?
The reason you are seeing this behavior is because the Visual Studio source control provider interface only gets invoked by adding the file via the solution explorer. Modifying the project file directly will not notify the source control provider that it needs to add a new file to source control. If you generate new files, then the routine that generates those files will also need to make the calls to the source control library (usually via a command line interface but it could have a .net api as well) to add the newly created file to source control.
Use CMake instead of maintaining VStudio project/workspace/solution files. Track the CMakeLists.txt files, and then generate a valid build environment.