I am using Visual Studio 2019 and trying to exclude wwwroot\js\src files from getting copied to IIS when publishing. Similar questions have been asked but those what I have referred to don't work because some of the project file syntax shown in those examples are not valid. Even the Microsoft documented method is not working.
MS Official documentation - wpp.target files has no effect on publish. It still copies the wwwroot\js\src files.
This - In vs 2019; CopyToPublishDirectory is not a valid attribute to Content tag. However the valid syntax below:
<ItemGroup>
<Content Update="wwwroot\js\src\**">
<CopyToPublishDirectory>false</CopyToPublishDirectory>
</Content>
</ItemGroup>
still publishes the js\src folder to IIS.
This - doesn't help either.
This must be quite a simple task and yet not straight forward way to get it done. Any help is appreciated.
Well,
This syntax worked after I add it to the csproj file. However the according to intellisense says it's invalid, but it works. Seems to be an issue on Microsoft side
<ItemGroup>
<Content Update="wwwroot\js\src\**\*">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
The tooltip says CopyToPublishDirectory can only have a boolean value of true/false
and If I do that this doesn't work!
Related
A web project that includes typescript and makes use of the "Redirect Javascript output to folder" option can currently not be published (local file system) because Microsoft.TypeScript.targets does not honor TypeScriptOutDir when populating FilesForPackagingFromProject and/or other MSBuild variables.
This is a small snippet extracted from my .csproj file:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptSourceMap>True</TypeScriptSourceMap>
<TypeScriptModuleKind>amd</TypeScriptModuleKind>
<TypeScriptOutDir>$(ProjectDir)Scripts\ts</TypeScriptOutDir>
</PropertyGroup>
The offending option is TypeScriptOutDir. If I remove it, publishing works as expected.
Did anyone else experience the same problem and has comeup with a work-around? I don't care if a fix would involve editing Microsoft.TypeScript.targets.
I just upgraded to the latest version of WebEssentials v3 and the TS files in my ASP MVC 4 project aren't compiling to JS anymore. I verified that the Options --> Text Editor --> TypeScript --> Project --> Automatically compile TypeScript files which are part of a project option is checked, but nothing happens when I save or compile my project. I've tried deleting the existing .js and .min.js files that WE2 created, but that didn't help. I tried adding a new TS file to my project that and didn't generate a JS file. I reinstalled TS 0.9.1.1 and that didn't help.
Sooooo what to do? Am I missing something obvious? Is something not working or do I just have the wrong expectations?
Do I need to go back to WE2?
Update: I even created a brand new ASP MVC 4 C# project to verify it wasn't just my original project, but I got the same results.
Interestingly enough, I just created a new TypeScript project and my TS files compiled properly on save... So that's interesting..
There are some links in the change log of WE3, here is the one describes how to enable the compile-on-save feature, see http://typescript.codeplex.com/wikipage?title=Compile-on-Save for details.
I've created a nuget package called Ltc.MSBuild.TS0911WE3.targets which will do the trick for you, just open Package Manager Console, type in Install-Package Ltc.MSBuild.TS0911WE3.targets!
Go to Ltc.MSBuild.TS0911WE3.targets on nuget.org.
I'm not sure if this is the correct method of dealing with the problem, but here's what I did to get "compile on save" working on my project...
After noticing that Compile On Save worked when starting from a new HTML Application with TypeScript project, I did a comparison between that and my non-working ASP MVC project. Turns out, my ASP MVC project was missing this bit of code..
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptRemoveComments>false</TypeScriptRemoveComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptRemoveComments>true</TypeScriptRemoveComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
Copy/pasting that into my ASP MVC project gave me Compile On Save support again. Of course, it's still not exactly what I expected. The resultant JS files are not added to the project automatically, so that's something I had to do manually. I also had to manually group the JS file with the TS file to mimic the same experience I was getting with WE2.
Hope that helps someone. Would love to hear some feedback on the solution.
Make sure your .proj file has a TypeScriptCompile XML section. You can copy from the typescript project if its not present.
Here is the specification : https://msbuildtypescript.codeplex.com/
using the "web essentials" tool (free, recomended) enable the preview pane in the web essentials options
Tools --> Options --> Web essentials --> Typescript: Show Preview Pane[X]
Now every time you save an open TS file, web essentials makes sure the file compiles (so it can display it) and you can update your javascript code while the project is running.
Error is as follows:
C:\Users\[username]\Google Drive\VS2010\Projects\[project name]\[project name]\Views\Show\EditOrder.cshtml: ASP.NET runtime error: Could not load file or assembly 'EntityFramework (1)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Hey all,
Got a strange problem here. seemingly randomly my project completely borked itself. A little bit of background: It's a ASP.Net MVC3 (.Net Framework 4) project that I mostly authored in Visual Web Developer 2010 Express. I say mostly because you'll note in the verbose error above I've stored it on my Google Drive. I'm syncing this project back and forth to my new development laptop, with an install of Visual Studio 2010 Professional. This probably isn't a great idea, but I wanted a simple method of working on it here on my desktop (at the office), at home (on my dev laptop), and on the road (again, dev laptop.)
Any ideas on what might have happened, and how I can fix this?
Bit more of background, now that I'm remembering this ... I had issues publishing it to our local IIS 6 server. I realized I had to add the _bin_deployableAssemblies to the package for it to work. At some point, I had deleted them from the project and re-added them. It was probably around that time, or at least within a few hours, that this issue started happening.
I can has halp?
Your MVC 3 project has a reference to one version of Entity Framework, but actually finds a different version when attempting to resolve the reference to Entity Framework on the computer where you get this error.
The simplest solution is probably to update to the current version of Entity Framework on your current computer, where you get the error.
If you open your project's .csproj file in a regular text editor (e.g. Notepad) you should see a line similar to this one:
<Reference Include="EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.4.3.1\lib\net40\EntityFramework.dll</HintPath>
</Reference>
That will tell you the version your application is expecting to find. If you see
<SpecificVersion>False</SpecificVersion>
then the expected version or a later version can be used.
Another way to resolve this kind of loading issue is using the Fusion Log Viewer, which will show you binding attempts that fail and what the loader tried (make sure you run it as Administrator or it will silently just do nothing).
Bloody strange ..
Looking in my /[Project Name]/bin folder I found 4 strange files:
EntityFramework (1).dll
EntityFramework (1).xml
[Project Name] (1).dll
[Project Name] (1).pdb
In any case, after deleting them guys and doing a Rebuild, all is well!
(Anyone have any ideas as to how or why this happened? Might be a Google Drive issue, now that I'm thinking about it ...
It was a Google Drive issue for me. If you remove all files ending with (1) in your Project/bin folder it should resolve the problem.
My view has errors. I see these errors only if I open the view in Visual Studio.
I would like to see the errors on compile time rather than on execute time.
Does exist a way to obtain this behavior?
You can update by hand the .csproj file and add a <MvcBuildViews>true</MvcBuildViews> that will compile the views as you go.
Here's a link I googled, you'll find others as well.
EDIT: If it's too slow try setting the build only for Release, edit the csproj file doing something like this; see the docs for AspNetCompiler for more details.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
<AspNetCompiler VirtualPath="Temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
I assume you are talking about C# compile errors and not things like CSS validation errors.
One thing you can do is add a Web Deployment Project to your solution. When it builds, it will run aspnet_compiler.exe on your project which will expose any of these C# compile errors in .aspx files that otherwise wouldn't be indicated until the .aspx file was compiled on the fly at runtime.
I have a Delphi (2007) project which, when I opened it, gave a very long delay (i.e., 2 full minutes) before the IDE became responsive.
I have other projects that are as large as this one, and there was no such delay. Finally I took a look inside the .DPROJ file, and found hundreds of entries like this one:
<None Include="ModelSupport_MyProjectName\Unit1\default.txaPackage" />
<None Include="ModelSupport_MyProjectName\Unit2\default.txaPackage" />
<None Include="ModelSupport_MyProjectName\Unit3\default.txaPackage" />
I deleted all of those lines, and now the huge delay is gone.
So what is the purpose of these lines? Why did they create such a long delay? Did I do any harm by removing them? More generally, is there good documentation on the structure of the .DPROJ file format from Codegear/Embarcadero?
These are Together files. To display your code as UML class diagram for example. I'm not sure but the delay could be from the Together packages loading or maybe the diagrams loading or updating.
There is no harm in removing them, unless you wanted to use the model support. Some refactorings also require them.
.dproj files are Microsoft msbuild files of which the structure is documented here, but there is no documentation to my knowledge of the Delphi specific use of msbuild there.
I'v noticed on more than one occasion the IDE in 2007 is messing up the dproj file, i.e. adding random dependencies. I hope the later version have this fixed because it can be a real pain in the *ss ;-)