Specify value for ~remoteAppUrl in an Office add-in manifest - outlook

I'm writing an add-in for Outlook using the new framework. The manifest in the project template uses ~remoteAppUrl to represent the location of the web files. It works great during development, but to publish to the Office Store I need the production URL there. If I save the production URL to the manifest, the production server gets used during debugging, and so local changes don't show up.
The documentation mentions Visual Studio filling in this value during debugging:
Next, Visual Studio does the following:
1. Modifies the SourceLocation element of the XML manifest file by replacing the ~remoteAppUrl token with the fully qualified address of the start page (for example, http://localhost/MyAgave.html).
Is there a built-in way to have Visual Studio fill in the production URL at the appropriate time (before/during Office Store submittal), and not break debugging?

Yes, there is a built-in way to have Visual Studio replace the ~remoteAppUrl symbolic reference token by the target URL of your choice.
From Visual Studio, access the "Publish..." option of the add-in
project, then click on the "Package the add-in" button
You can then enter the URL in the modal dialog that pops up
A build is then triggered that will inject the URL in the produced Manifest XML file
A Windows Explorer window will conveniently open to show the
produced file.
The following ways are not built-in but may be useful as well.
If you want this in an automated build, you need to specify values for the build parameters IsPackaging (True) and RemoteAppUrl.
If you want this in the standard Visual Studio Build, given that Visual Studio does not provide an easy way to specify Build parameters (see How to emulate /p msbuild parameter in Visual Studio build?) you will need to edit your project file to set the values of the same build parameters.
For instance like this:
...
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...
<IsPackaging>True</IsPackaging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<RemoteAppUrl>https://localhost:44300</RemoteAppUrl>
</PropertyGroup>
...
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
...
<RemoteAppUrl>https://your.own.url</RemoteAppUrl>
</PropertyGroup>
...

Edit:
Visual Studio will not fill in the production URL, however you can copy your current manifest and replace the ~remoteAppUrl with your appropriate host manually, thus giving you a production and debug version of your add-in.
Original for posterity
~remoteAppUrl is a placeholder for wherever your files are hosted. For instance, if you have uploaded your add-in to an Azure Web App, your remote app url would be something along the lines of myWebApp.azurewebsites.net

I would like to bring the light on where the value comes from to replace the ~remoteAppUrl parameter. Add-in .csproj file contains the reference to the WebApp project:
<ItemGroup>
<ProjectReference Include="..\OutlookWebAddIn1Web\OutlookWebAddIn1Web.csproj">
<Project>{57AC33A8-A364-4084-B41F-319C5DBB9FB4}</Project>
<Name>OutlookWebAddIn1Web</Name>
<Private>True</Private>
<RoleType>Web</RoleType>
<OutputItemType>SharePointWebProjectOutput</OutputItemType>
<RoleName>OutlookWebAddIn1Web</RoleName>
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
I think it takes the URL from the WebApp .csproj file:

Related

UWP package creation Error info: Packaname different

I have an issue updating my UWP app on Windows store. The issue is on the level of Visual studio (for windows). The description of the issue is the following:
Error info: error 80080204: The package with file name "MyApp_VersionNumber_x64.msix" and package full name "PackageName_VersionNumber_x64__Suffix" is not valid in the bundle because it has a different package family name than other packages in the bundle. The expected publisher is CN=PublisherName. AppName Prefix_Path\AppName\MakeAppx
The context is the following:
I update the app source code, then I associated the app in the store with the one updated.
In the windows related to the Application packages creation:
a. I choosed the distribute the application in windows store
b. Next, I choosed to always generate the application bath. (When I choose not to generate, it is impossible to publish the update because appxbundle is missing)
c. I selected the build x86, x64 and ARM like I did before
d. Finally I launch the creation to get the error above.
I followed multiple possible answer but nothing works.
Can someone helps me to overcome this issue?
Regards.
I had the same problem, the fix is a bit annoying, but for me it worked:
Close Visual Studio, go into your fileexplorer and open up the Folder with your project. Inside it you should find the "projectname.csproj" file. Open it up in your favorite texteditor and now follow the steps below:
1: Look for this line and also make sure it is the line with 'Release' and not 'Debug' in it:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
2: Inside the PropertyGroup tags you will find this line:
The value can either be true or false. If it is false, change it to true
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
Now repeate these steps for all four Release configurations and ONLY Release not Debug:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
After this, save the file and reopen Visual Studio. It now should create the package.

Visual Studio 2019 hangs when opening a solution with a dual targeted dotnet core and net framework project converted by hand

A developer migrated a csproj file to the newer csproj syntax. The top of the csproj file follows:
<Project DefaultTargets="Build" Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4CF6CFA6-13B2-426E-913B-A42BF6642A69}</ProjectGuid>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
Other developers were no longer able to open the two solution files containing this project. Visual studio would begin opening the solution, but the progress bar would hang when it got to this converted project. It should be noted that many other projects had been migrated without this issue.
A blank solution was created and the hanging project was added to this blank solution. This opened without a hang.
Any ideas on what could be done to allow this project to not hang. I suppose a new project could be created as a work around.
I was able to correct the hang by creating a new project GUID and replacing the old project GUID in the csproj and sln files. This allowed the solution to open. I used the Visual Studio GUID tool available in the Visual Studio Tools main menu to create the GUID in registry format.

Only sign assemblies with strong name during release build

The scenario is: I'm building my solution with TeamCity, I'm not running the build account as an administrator; so I get problems with the strong name keys.
I know of a few solutions out there, like running the build as an administrator and registering the certificates in the proper container.
Is there anyway to sign the assemblies within a solution file only during a release build and not during a debug build. Or are there any similar solutions?
I think it is strange that there isn't a MSBuild parameter that can be set wether the assemblies should be signed or not. Because if you look at the csproj-files there is an option there for signed or not signed
Another option is to edit the project file. By default if you enable assembly signing in Visual Studio it will be used for all build configurations. The project file contains an element like the following.
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>YourKeyFile.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
If you only want to sign the assemblies during a specifc build configuration, such as RELEASE. You can put the <SignAssembly> and <AssemblyOriginatorKeyFile> in the PropertyGroup element with the Condition that identifies your build configuration.
So if you want to sign your assembly during a release build, you can change your project file to the following.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<!-- other element of this PropertyGroup -->
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>YourKeyFile.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
Note: When you change your project file, to the following. you cannot change the signing settings of the Project Properties in Visual Studio. That means in Visual Studio is signing of the assembly disabled, also if you change the build configuration in Visual Studio.
Here's a solution where the assembly is signed in Release configuration, but not in Debug configuration. It uses the signing facilities from the project, not using the [AssemblyKeyFile] attribute. It's basically the same as Jehof's answer but in other words.
Set up the project for signing in the Signing tab in project preferences.
Unload the project, and edit it in the XML editor. Locate the SignAssembly property. Move that property into the two configuration dependent property groups. In the Debug configuration, set the property to false.
This will look something like this:
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<!-- ... -->
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<SignAssembly>true</SignAssembly>
</PropertyGroup>
Visual Studio works correctly even when changing build configurations, with the exception of the Sign the assembly check box in the Signing tab. I tested with Visual Studio 2008.
Cave-Eats:
You need to remove the [AssemblyKeyFile] attribute for this to work.
If you have [InternalsVisibleTo] attributes, you need to maintain two versions, like this:
#if DEBUG
[assembly: InternalsVisibleTo("MyLib.NUnit")]
#else
[assembly: InternalsVisibleTo("MyLib.NUnit, PublicKey=<your public key>")]
#endif
In other words, MyLib.NUnit must also be signed in Release configuration.
You can use preprocessor directives:
#if SIGN
//Only the Release build is signed
#pragma warning disable 1699 //We can't use the compiler switch
[assembly: AssemblyKeyName("KeyContainerName")]
#pragma warning restore 1699
#endif
Then define the SIGN symbol in the Release configuration.
You must install the key into a key container using sn.exe. Alternatively, you can use [AssemblykeyFile] to specify a path.
The #pragma suppresses this warning.

Exclude files from web site publish in Visual Studio

Can I exclude a folder or files when I publish a web site in Visual Studio 2005? I have various resources that I want to keep at hand in the Solution Explorer, such as alternate config files for various environments, but I don't really want to publish them to the server. Is there some way to exclude them? When using other project types, such as a .dll assembly, I can set a file's Build Action property to "None" and its Copy to Output Directory property to "Do not copy". I cannot find any similar settings for files in a web site.
If the IDE does not offer this feature, does anyone have good technique for handling such files?
Exclude files and folders by adding ExcludeFilesFromDeployment and ExcludeFoldersFromDeployment elements to your project file (.csproj, .vbproj, etc). You will need to edit the file in a text editor, or in Visual Studio by unloading the project and then editing it.
Add the tags anywhere within the appropriate PropertyGroup (Debug, Release, etc) as shown below:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<ExcludeFilesFromDeployment>File1.aspx;Folder2\File2.aspx</ExcludeFilesFromDeployment>
<ExcludeFilesFromDeployment>**\.svn\**\*.*</ExcludeFilesFromDeployment>
<ExcludeFoldersFromDeployment>Folder1;Folder2\Folder2a</ExcludeFoldersFromDeployment>
</PropertyGroup>
Wildcards are supported.
To explain the example above:
The 1st ExcludeFilesFromDeployment excludes File1.aspx (in root of project) and Folder2\File2.aspx (Folder2 is in the root of the project)
The 2nd ExcludeFilesFromDeployment excludes all files within any folder named .svn and any of its subfolders
The ExcludeFoldersFromDeployment excludes folders named Folder1 (in root of project) and Folder2\Folder2a (Folder2 is in the root of the project)
For more info see MSDN blog post Web Deployment: Excluding Files and Folders via the Web Application’s Project File
Amazingly the answer for Visual Studio 2012 is not here:
The answer with green checkmark is not the answer.
The highest "upped" answer references an article from 2010 and says you have to edit your csproj project file which is now incorrect. I added the ExcludeFoldersFromDeployment XML element to my Visual Studio 2012 csproj file and it did nothing, the element was considered invalid, this is because ExcludeFoldersFromDeployment has been moved to the .pubxml file it looks like.
For Web Applications and Websites you edit the .pubxml file!
You can follow my answer or try this guide which I found later:
http://www.leniel.net/2014/05/using-msdeploy-publish-profile-pubxml-to-create-an-empty-folder-structure-on-iis-and-skip-deleting-it-with-msdeployskiprules.html#sthash.MSsQD8U1.dpbs
Yes, you can do this not just for Website Projects but Websites too. I spent a long time on the internet looking for this elusive exclude ability with a Visual Studio Website (NOT Website project) and had previously concluded it was not possible but it looks like it is:
In your [mypublishwebsitename].pubxml file, found in ~/Properties/PublishProfiles for Web Application Projects and ~/App_Data/PublishProfiles for Websites, simply add:
<ExcludeFilesFromDeployment>File1.aspx;Folder2\File2.aspx</ExcludeFilesFromDeployment>
<ExcludeFoldersFromDeployment>Folder1;Folder2\Folder2a</ExcludeFoldersFromDeployment>
as children to the main <PropertyGroup> element in your .pubxml file. No need to add a new element not unless you are keying a specific build type, like release or debug.
BUT WAIT!!!
If you are removing files from your destination/target server with the following setting in your Publish configuration:
Then the Web Publish process will delete on your source/target server anything excluded, like an item you have delineated in your <ExcludeFoldersFromDeployment> and <ExcludeFilesFromDeployment>!
MsDeploy Skip Rules to the rescue:
First, Web Publish uses something other than MSBuild to publish (called Task IO or something like that) but it has a bug and will not recognize skip rules, so you must add to your .pubxml:
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
</PropertyGroup>
I would keep <WebPublishMethod> in its own <PropertyGroup>, you would think you could just have one <PropertyGroup> element in your .pubxml but my Skip Rules were not being called until I moved <WebPublishMethod> to its own <PropertyGroup> element. Yes, crazy, but the fact you need to do all this for Web Publish to exclude and also not delete a folder/file on your server is crazy.
Now my actual SkipRules, ExcludeFolders and ExcludeFiles declarations in my .pubxml:
<ExcludeFoldersFromDeployment>Config</ExcludeFoldersFromDeployment>
<ExcludeFoldersFromDeployment>Photos</ExcludeFoldersFromDeployment>
<ExcludeFoldersFromDeployment>Temp</ExcludeFoldersFromDeployment>
<ExcludeFilesFromDeployment>Web.config</ExcludeFilesFromDeployment>
<AfterAddIisSettingAndFileContentsToSourceManifest>AddCustomSkipRules</AfterAddIisSettingAndFileContentsToSourceManifest>
And now a the Skip Rules (<Target> is a child of <Project> in your .pubxml):
(You may be able to leave <SkipAction> empty to Skip for all actions but I didn't test that and am not sure.
<Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
<MsDeploySkipRules Include="SkipConfigFolder">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\Config</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipPhotosFolder">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\Photos</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipWebConfig">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\Web\.config</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipWebConfig">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\Temp</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
And please, do not to forget to escape the . in a filePath Skip rule with a backslash.
If you can identify the files based on extension, you can configure this using the buildproviders tag in the web.config. Add the extension and map it to the ForceCopyBuildProvider. For example, to configure .xml files to be copied with a publish action, you would do the following:
<configuration>...
<system.web>...
<compilation>...
<buildProviders>
<remove extension=".xml" />
<add extension=".xml" type="System.Web.Compilation.ForceCopyBuildProvider" />
</buildProviders>
To keep a given file from being copied, you'd do the same thing but use System.Web.Compilation.IgnoreFileBuildProvider as the type.
I struggled with the same issue and finally pulled the trigger on converting the web site to a web application. Once I did this, I got all of the IDE benefits such as build action, and it compiled faster to boot (no more validating web site...).
Step 1: Convert your 'web site' to a 'web application'. To convert it I just created a new "web application", blew away all the files it created automatically, and copied and pasted my web site in. This worked fine. Note that report files will need to have their Build Action set to "Content" instead of "none".
Step 2: Now you can set any files "Build Action" property.
Hope this helps.
In Visual Studio 2013 I found Keith's answer, adding the ExcludeFoldersFromDeployment element to the project file, didn't work (I hadn't read Brian Ogden's answer which says this). However, I found I could exclude a text file when publishing in Visual Studio 2013 by just setting the following properties on the text file itself:
1) Build Action: None
2) Copy to Output Directory: Do not copy
Initially I tried setting the Copy to Output Directory property by itself but that didn't work when the Build Action was set to the default value, Content. When I then set the Build Action to None the text file was no longer copied to the destination folder when I published.
To view these properties in the Visual Studio GUI, in the Solution Explorer right-click on the file you want to exclude and select Properties from the context menu.
I think you only have two options here:
Use the 'Exclude From Project'
feature. This isn't ideal because the
project item will be excluded from
any integrated IDE source control operations.
You would need to click the 'Show All
Files' button on the Solution window
if you need to see the files in
Solution Explorer, but that also
shows files and folders you're not
interested in.
Use a post-build event script to
remove any project items you don't
want to be published (assuming you're
publishing to a local folder then
uploading to the server).
I've been through this before and couldn't come up with anything really elegant.
For Visual Studio 2017, WebApp Publish, first create a standard file system publish profile.
Go to the App_Data\PublishProfiles\ folder and edit the [profilename].pubxml file.
Add
<ExcludeFilesFromDeployment>[file1.ext];[file2.ext];[file(n).ext]</ExcludeFilesFromDeployment>
under the tag<PropertyGroup>
You can only specify this tag once, otherwise it will only take the last one's values.
Example:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\inetput\mysite</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeFilesFromDeployment>web.config;mysite.sln;App_Code\DevClass.cs;</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
Make sure that the tag DeleteExistingFiles is set to False
As a contemporary answer, in Visual Studio 2017 with a .net core site:
You can exclude from publish like so in the csproj, where CopyToPublishDirectory is never.
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="appsettings.Local.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
This is discussed in more detail here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-2.2
<PropertyGroup>
<ExcludeFilesFromDeployment>appsettings.Local.json</ExcludeFilesFromDeployment>
</PropertyGroup>
The earlier suggestions did not work for me, I'm guessing because visual studio is now using a different publishing mechanism underneath, I presume via the "dotnet publish" cli tool or equivalent underneath.
The feature you are looking exists if your project is created as a "Web Application". Web Site "projects" are just a collection of files that are thought of as 1:1 with what gets deployed to a web server.
In terms of functionality both are the same, however a web application compiles all source code to a DLL, instead of the naked source code files being copied to the web server and compiled as needed.
This is just an addendum to the other helpful answers here and something I've found useful...
Using wpp.targets to excluded files and folders
When you have multiple deployments for different environments then it's helpful to have just one common file where you can set all the excluded files and folders. You can do this by creating a *.wpp.targets file in the root of the project like the example below.
For more information see this Microsoft guide:
How to: Edit Deployment Settings in Publish Profile (.pubxml) Files and the .wpp.targets File in Visual Studio Web Projects
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<EnableMSDeployAppOffline>True</EnableMSDeployAppOffline>
<ExcludeFilesFromDeployment>
*.config;
*.targets;
*.default;
</ExcludeFilesFromDeployment>
<ExcludeFoldersFromDeployment>
images;
videos;
uploads;
</ExcludeFoldersFromDeployment>
</PropertyGroup>
</Project>
In Visual Studio 2017 (15.9.3 in my case) the manipulation of the .csproj-File works fine indeed! No need to modify the pubxml.
You can then construct pretty nice settings in the .csproj-File using the PropertyGroup condition, e.g.:
<PropertyGroup Condition="$(Configuration.StartsWith('Pub_'))">
<ExcludeFoldersFromDeployment>Samples</ExcludeFoldersFromDeployment>
</PropertyGroup>
excludes the "Samples" folder from all deployments with configurations starting with "Pub_"...
In Visual Studio 2022 I have successfully used this settings:
Go and edit the
[ProjectName] \ Properties \ PublishProfiles \ FolderProfile.pubxml file
in solution explorer.
Add these lines inside PropertyGroup
element:
<ItemGroup>
<Content Remove="Data\*.json" />
<None Include="Data\*.json" />
</ItemGroup>
Then save the .pubxml file and try to publish the project.
"Content Remove" will remove the file from the content to deploy.
"None Include" will keep the file in the solution explorer.
It's possible to set it up in the solution explorer for single files as well: right click the file in the solution explorer -> Properties and change the Build Action to None.

How to get t4 files to build in visual studio?

When I build my c# solution the .tt files will not create the .cs file outputs. But if I right click the .tt files one at a time in solution explorer and select "Run Custom Tool" the .cs is generated, so the build tool setting is correct. What do I do to get the overall solution build to force the custom tool to run on the .tt files?
Paul, you can also generate code at build time with TextTransform.exe or Elton Stoneman's MSBuild task. Just keep in mind that behavior of the built-in directives, like assembly and include is different when T4 runs in Visual Studio vs. the command-line host.
Answering my own question, they are supposed to be generated at design time as per this discussion:
https://web.archive.org/web/20081227142303/http://www.olegsych.com/2008/02/t4-template-directive/
In Visual Studio 2017 (probably next versions too), you should add this in Pre-build event:
"$(DevEnvDir)TextTransform.exe" -out "$(ProjectDir)YourTemplate.cs" "$(ProjectDir)YourTemplate.tt"
p.s. The only solution that worked for me.
p.s.s. Change path to your template if it's located not in root project directory.
In Visual Studio 2013, I was able to get the .tt files to regenerate their targets by just adding these lines to the .csproj file:
<PropertyGroup>
<!-- Get the Visual Studio version – defaults to 10: -->
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<!-- Keep the next element all on one line: -->
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<!-- To enable build tasks on your development computer, install Modeling SDK for Visual Studio. https://www.microsoft.com/en-us/download/details.aspx?id=40754 -->
<Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" />
<!-- Run the Transform task at the start of every build -->
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
</PropertyGroup>
<!-- Overwrite files that are read-only, for example because they are not checked out -->
<PropertyGroup>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
</PropertyGroup>
<!-- Transform every template every time -->
<PropertyGroup>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
</PropertyGroup>
However, for this to work, you'll need to have installed the Modeling SDK for Visual Studio. I found all of this information, along with a more complete description of the options available, on this page: Code Generation in a Build Process.

Resources